mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 00:57:44 -04:00
Change important printf
s to lg::print
(#3355)
This allows them to be logged into a file, useful for debugging. With this, GOAL `format` and C-kernel `Msg` (and its variants) will be logged.
This commit is contained in:
parent
b331d16bcc
commit
d67b441dac
|
@ -112,8 +112,31 @@ void log_print(const char* message) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void log_vprintf(const char* format, va_list arg_list) {
|
||||
{
|
||||
// We always immediately flush prints because since it has no associated level
|
||||
// it could be anything from a fatal error to a useless debug log.
|
||||
std::lock_guard<std::mutex> lock(gLogger.mutex);
|
||||
if (gLogger.fp) {
|
||||
// Log to File
|
||||
vfprintf(gLogger.fp, format, arg_list);
|
||||
fflush(gLogger.fp);
|
||||
}
|
||||
|
||||
if (gLogger.stdout_log_level < lg::level::off_unless_die) {
|
||||
vprintf(format, arg_list);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace internal
|
||||
|
||||
void printstd(const std::string& format, va_list arg_list) {
|
||||
internal::log_vprintf(format.c_str(), arg_list);
|
||||
}
|
||||
|
||||
// how many extra log files for a single program should be kept?
|
||||
constexpr int LOG_ROTATE_MAX = 10;
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace internal {
|
|||
// log implementation stuff, not to be called by the user
|
||||
void log_message(level log_level, LogTime& now, const char* message);
|
||||
void log_print(const char* message);
|
||||
void log_vprintf(const char* format, va_list arg_list);
|
||||
} // namespace internal
|
||||
|
||||
void set_file(const std::string& filename,
|
||||
|
@ -75,6 +76,9 @@ void print(const fmt::text_style& ts, const std::string& format, Args&&... args)
|
|||
internal::log_print(formatted_message.c_str());
|
||||
}
|
||||
|
||||
// same as print but uses the C printf instead of fmt
|
||||
void printstd(const std::string& format, va_list arg_list);
|
||||
|
||||
template <typename... Args>
|
||||
void trace(const std::string& format, Args&&... args) {
|
||||
log(level::trace, format, std::forward<Args>(args)...);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "dgo_util.h"
|
||||
|
||||
#include "common/link_types.h"
|
||||
#include "common/log/log.h"
|
||||
|
||||
#include "third-party/json.hpp"
|
||||
|
||||
|
@ -25,9 +26,9 @@ DgoReader::DgoReader(std::string file_name, const std::vector<u8>& data)
|
|||
|
||||
if (reader.bytes_left() < obj_header.size && i == header.object_count - 1 &&
|
||||
obj_header.size - reader.bytes_left() <= 48) {
|
||||
printf(
|
||||
"Warning: final file %s in DGO %s has a size missing %d bytes. It will be adjusted from "
|
||||
"%d to %d bytes.\n",
|
||||
lg::print(
|
||||
"Warning: final file {} in DGO {} has a size missing {} bytes. It will be adjusted from "
|
||||
"{} to {} bytes.\n",
|
||||
obj_header.name, header.name, obj_header.size - reader.bytes_left(), obj_header.size,
|
||||
(int)reader.bytes_left());
|
||||
obj_header.size = reader.bytes_left();
|
||||
|
@ -40,7 +41,7 @@ DgoReader::DgoReader(std::string file_name, const std::vector<u8>& data)
|
|||
|
||||
entry.unique_name = get_object_file_name(entry.internal_name, reader.here(), obj_header.size);
|
||||
if (all_unique_names.find(entry.unique_name) != all_unique_names.end()) {
|
||||
printf("Warning: there are multiple files named %s\n", entry.unique_name.c_str());
|
||||
lg::print("Warning: there are multiple files named {}\n", entry.unique_name.c_str());
|
||||
entry.unique_name += '-';
|
||||
entry.unique_name += std::to_string(obj_header.size);
|
||||
}
|
||||
|
|
|
@ -134,4 +134,4 @@ void RenderMux::init_shaders(ShaderLibrary& sl) {
|
|||
for (auto& rend : m_renderers) {
|
||||
rend->init_shaders(sl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -605,31 +605,31 @@ Fbo make_fbo(int w, int h, int msaa, bool make_zbuf_and_stencil) {
|
|||
auto status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
||||
lg::error("Failed to setup framebuffer: {} {} {} {}\n", w, h, msaa, make_zbuf_and_stencil);
|
||||
lg::error("Failed to setup framebuffer: {} {} {} {} ", w, h, msaa, make_zbuf_and_stencil);
|
||||
switch (status) {
|
||||
case GL_FRAMEBUFFER_UNDEFINED:
|
||||
printf("GL_FRAMEBUFFER_UNDEFINED\n");
|
||||
lg::print("GL_FRAMEBUFFER_UNDEFINED\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
|
||||
printf("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\n");
|
||||
lg::print("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
|
||||
printf("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\n");
|
||||
lg::print("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
|
||||
printf("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\n");
|
||||
lg::print("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
|
||||
printf("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER\n");
|
||||
lg::print("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED:
|
||||
printf("GL_FRAMEBUFFER_UNSUPPORTED\n");
|
||||
lg::print("GL_FRAMEBUFFER_UNSUPPORTED\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
|
||||
printf("GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE\n");
|
||||
lg::print("GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
|
||||
printf("GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS\n");
|
||||
lg::print("GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS\n");
|
||||
break;
|
||||
}
|
||||
ASSERT(false);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "TextureAnimator.h"
|
||||
|
||||
#include "common/global_profiler/GlobalProfiler.h"
|
||||
#include "common/log/log.h"
|
||||
#include "common/texture/texture_slots.h"
|
||||
#include "common/util/FileUtil.h"
|
||||
#include "common/util/Timer.h"
|
||||
|
@ -188,7 +189,7 @@ const tfrag3::Texture* tex_by_name(const tfrag3::Level* level, const std::string
|
|||
if (!ret) {
|
||||
lg::error("no texture named {}", name);
|
||||
for (const auto& t : level->textures) {
|
||||
fmt::print("texture: {}\n", t.debug_name);
|
||||
lg::print("texture: {}\n", t.debug_name);
|
||||
}
|
||||
lg::die("no texture named {}", name);
|
||||
} else {
|
||||
|
@ -808,13 +809,13 @@ void TextureAnimator::handle_texture_anim_data(DmaFollower& dma,
|
|||
handle_slime(tf, texture_pool);
|
||||
} break;
|
||||
default:
|
||||
fmt::print("bad imm: {}\n", vif0.immediate);
|
||||
lg::print("bad imm: {}\n", vif0.immediate);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
} else {
|
||||
printf("[tex anim] unhandled VIF in main loop\n");
|
||||
fmt::print("{} {}\n", vif0.print(), tf.vifcode1().print());
|
||||
fmt::print("dma address 0x{:x}\n", offset);
|
||||
lg::print("[tex anim] unhandled VIF in main loop\n");
|
||||
lg::print("{} {}\n", vif0.print(), tf.vifcode1().print());
|
||||
lg::print("dma address 0x{:x}\n", offset);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
@ -897,7 +898,7 @@ void TextureAnimator::force_to_gpu(int tbp) {
|
|||
auto& entry = m_textures.at(tbp);
|
||||
switch (entry.kind) {
|
||||
default:
|
||||
printf("unhandled non-gpu conversion: %d (tbp = %d)\n", (int)entry.kind, tbp);
|
||||
lg::print("unhandled non-gpu conversion: {} (tbp = {})\n", (int)entry.kind, tbp);
|
||||
ASSERT_NOT_REACHED();
|
||||
case VramEntry::Kind::CLUT16_16_IN_PSM32:
|
||||
// HACK: never convert known CLUT textures to GPU.
|
||||
|
@ -996,7 +997,7 @@ void debug_save_opengl_texture(const std::string& out, GLuint texture) {
|
|||
int w, h;
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
|
||||
fmt::print("saving texture with size {} x {}\n", w, h);
|
||||
lg::print("saving texture with size {} x {}\n", w, h);
|
||||
std::vector<u8> data(w * h * 4);
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, data.data());
|
||||
file_util::write_rgba_png(out, data.data(), w, h);
|
||||
|
@ -1171,7 +1172,7 @@ void TextureAnimator::handle_generic_upload(const DmaTransfer& tf, const u8* ee_
|
|||
}
|
||||
break;
|
||||
default:
|
||||
fmt::print("Unhandled format: {}\n", upload->format);
|
||||
lg::print("Unhandled format: {}\n", upload->format);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
@ -1384,7 +1385,7 @@ void TextureAnimator::handle_draw(DmaFollower& dma, TexturePool& texture_pool) {
|
|||
void TextureAnimator::load_clut_to_converter() {
|
||||
const auto& clut_lookup = m_textures.find(m_current_shader.tex0.cbp());
|
||||
if (clut_lookup == m_textures.end()) {
|
||||
printf("set shader referenced an unknown clut texture in %d\n", m_current_shader.tex0.cbp());
|
||||
lg::print("set shader referenced an unknown clut texture in {}\n", m_current_shader.tex0.cbp());
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
@ -1394,7 +1395,7 @@ void TextureAnimator::load_clut_to_converter() {
|
|||
16);
|
||||
break;
|
||||
default:
|
||||
printf("unhandled clut source kind: %d\n", (int)clut_lookup->second.kind);
|
||||
lg::print("unhandled clut source kind: {}\n", (int)clut_lookup->second.kind);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
@ -1420,7 +1421,7 @@ GLuint TextureAnimator::make_or_get_gpu_texture_for_current_shader(TexturePool&
|
|||
if (tpool.has_value()) {
|
||||
return *tpool;
|
||||
}
|
||||
// printf("referenced an unknown texture in %d\n", tbp);
|
||||
// lg::print("referenced an unknown texture in {}\n", tbp);
|
||||
lg::error("unknown texture in {} (0x{:x})", tbp, tbp);
|
||||
return texture_pool.get_placeholder_texture();
|
||||
|
||||
|
@ -1450,8 +1451,8 @@ GLuint TextureAnimator::make_or_get_gpu_texture_for_current_shader(TexturePool&
|
|||
|
||||
const auto& clut_lookup = m_textures.find(m_current_shader.tex0.cbp());
|
||||
if (clut_lookup == m_textures.end()) {
|
||||
printf("set shader referenced an unknown clut texture in %d\n",
|
||||
m_current_shader.tex0.cbp());
|
||||
lg::print("set shader referenced an unknown clut texture in {}\n",
|
||||
m_current_shader.tex0.cbp());
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
@ -1459,7 +1460,7 @@ GLuint TextureAnimator::make_or_get_gpu_texture_for_current_shader(TexturePool&
|
|||
case VramEntry::Kind::CLUT16_16_IN_PSM32:
|
||||
break;
|
||||
default:
|
||||
printf("unhandled clut source kind: %d\n", (int)clut_lookup->second.kind);
|
||||
lg::print("unhandled clut source kind: {}\n", (int)clut_lookup->second.kind);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
@ -1502,7 +1503,8 @@ GLuint TextureAnimator::make_or_get_gpu_texture_for_current_shader(TexturePool&
|
|||
// file_util::write_rgba_png("out.png", rgba_data.data(), 1 <<
|
||||
// m_current_shader.tex0.tw(),
|
||||
// 1 << m_current_shader.tex0.th());
|
||||
printf("Scrambler took the slow path %d x %d took %.3f ms\n", w, h, timer.getMs());
|
||||
lg::print("Scrambler took the slow path {} x {} took {:.3f} ms\n", w, h,
|
||||
timer.getMs());
|
||||
}
|
||||
}
|
||||
auto ret = make_temp_gpu_texture(rgba_data.data(), w, h);
|
||||
|
@ -1512,7 +1514,7 @@ GLuint TextureAnimator::make_or_get_gpu_texture_for_current_shader(TexturePool&
|
|||
ASSERT_NOT_REACHED();
|
||||
} break;
|
||||
default:
|
||||
fmt::print("unhandled source texture format {}\n", (int)m_current_shader.tex0.psm());
|
||||
lg::print("unhandled source texture format {}\n", (int)m_current_shader.tex0.psm());
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
break;
|
||||
|
@ -1643,8 +1645,8 @@ bool TextureAnimator::set_up_opengl_for_shader(const ShaderContext& shader,
|
|||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||
} else {
|
||||
fmt::print("unhandled blend: {} {} {} {}\n", (int)blend_a, (int)blend_b, (int)blend_c,
|
||||
(int)blend_d);
|
||||
lg::print("unhandled blend: {} {} {} {}\n", (int)blend_a, (int)blend_b, (int)blend_c,
|
||||
(int)blend_d);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
@ -1722,7 +1724,7 @@ VramEntry* TextureAnimator::setup_vram_entry_for_gpu_texture(int w, int h, int t
|
|||
const u32* TextureAnimator::get_clut_16_16_psm32(int cbp) {
|
||||
const auto& clut_lookup = m_textures.find(cbp);
|
||||
if (clut_lookup == m_textures.end()) {
|
||||
printf("get_clut_16_16_psm32 referenced an unknown clut texture in %d\n", cbp);
|
||||
lg::print("get_clut_16_16_psm32 referenced an unknown clut texture in {}\n", cbp);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
@ -1790,8 +1792,8 @@ void TextureAnimator::set_up_opengl_for_fixed(const FixedLayerDef& def,
|
|||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||
} else {
|
||||
fmt::print("unhandled blend: {} {} {} {}\n", (int)blend_a, (int)blend_b, (int)blend_c,
|
||||
(int)blend_d);
|
||||
lg::print("unhandled blend: {} {} {} {}\n", (int)blend_a, (int)blend_b, (int)blend_c,
|
||||
(int)blend_d);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
@ -1828,7 +1830,7 @@ void TextureAnimator::set_uniforms_from_draw_data(const DrawData& dd, int dest_w
|
|||
convert_gs_position_to_vec3(pos + 9, dd.pos3, dest_w, dest_h);
|
||||
glUniform3fv(m_uniforms.positions, 4, pos);
|
||||
// for (int i = 0; i < 4; i++) {
|
||||
// fmt::print("fan vp {}: {:.3f} {:.3f} {:.3f}\n", i, pos[i * 3], pos[1 + i * 3], pos[2 + i *
|
||||
// lg::print("fan vp {}: {:.3f} {:.3f} {:.3f}\n", i, pos[i * 3], pos[1 + i * 3], pos[2 + i *
|
||||
// 3]);
|
||||
// }
|
||||
|
||||
|
@ -1839,7 +1841,7 @@ void TextureAnimator::set_uniforms_from_draw_data(const DrawData& dd, int dest_w
|
|||
convert_gs_uv_to_vec2(uv + 6, dd.st3);
|
||||
glUniform2fv(m_uniforms.uvs, 4, uv);
|
||||
// for (int i = 0; i < 4; i++) {
|
||||
// fmt::print("fan vt {}: {:.3f} {:.3f} \n", i, uv[i * 2], uv[1 + i * 2]);
|
||||
// lg::print("fan vt {}: {:.3f} {:.3f} \n", i, uv[i * 2], uv[1 + i * 2]);
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -2564,7 +2566,7 @@ void debug_save_opengl_u8_texture(const std::string& out, GLuint texture) {
|
|||
int w, h;
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
|
||||
fmt::print("saving texture with size {} x {}\n", w, h);
|
||||
lg::print("saving texture with size {} x {}\n", w, h);
|
||||
std::vector<u8> data_r(w * h);
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RED, GL_UNSIGNED_BYTE, data_r.data());
|
||||
std::vector<u8> data(w * h * 4);
|
||||
|
|
|
@ -35,30 +35,31 @@ FramebufferTexturePair::FramebufferTexturePair(int w, int h, u64 texture_format,
|
|||
glDrawBuffers(1, draw_buffers);
|
||||
auto status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
||||
lg::error("Failed to setup framebuffer texture pair: {} {} ", w, h);
|
||||
switch (status) {
|
||||
case GL_FRAMEBUFFER_UNDEFINED:
|
||||
printf("GL_FRAMEBUFFER_UNDEFINED\n");
|
||||
lg::error("GL_FRAMEBUFFER_UNDEFINED\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
|
||||
printf("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\n");
|
||||
lg::error("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
|
||||
printf("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\n");
|
||||
lg::error("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
|
||||
printf("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\n");
|
||||
lg::error("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
|
||||
printf("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER\n");
|
||||
lg::error("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED:
|
||||
printf("GL_FRAMEBUFFER_UNSUPPORTED\n");
|
||||
lg::error("GL_FRAMEBUFFER_UNSUPPORTED\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
|
||||
printf("GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE\n");
|
||||
lg::error("GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
|
||||
printf("GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS\n");
|
||||
lg::error("GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -228,4 +229,4 @@ void FramebufferCopier::copy_back_now(int render_fb_w, int render_fb_h, GLuint r
|
|||
);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, render_fb);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ u32 InitRPC() {
|
|||
!RpcBind(PLAY_RPC_CHANNEL, PLAY_RPC_ID[g_game_version])) {
|
||||
return 0;
|
||||
}
|
||||
printf("Entering endless loop ... please wait\n");
|
||||
lg::print("Entering endless loop ... please wait\n");
|
||||
for (;;) {
|
||||
}
|
||||
}
|
||||
|
@ -150,9 +150,9 @@ void StopIOP() {
|
|||
x[2] = 0x14; // todo - this type and message
|
||||
// RpcSync(PLAYER_RPC_CHANNEL);
|
||||
// RpcCall(PLAYER_RPC_CHANNEL, 0, false, x, 0x50, nullptr, 0);
|
||||
printf("IOP shut down\n");
|
||||
lg::print("IOP shut down\n");
|
||||
// sceDmaSync(0x10009000, 0, 0);
|
||||
printf("DMA shut down\n");
|
||||
lg::print("DMA shut down\n");
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -199,4 +199,4 @@ void LoadDGOTest() {
|
|||
|
||||
sShowStallMsg = lastShowStall;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <cstring>
|
||||
|
||||
#include "common/listener_common.h"
|
||||
#include "common/log/log.h"
|
||||
|
||||
#include "game/kernel/common/kdsnetm.h"
|
||||
#include "game/kernel/common/kprint.h"
|
||||
|
@ -27,7 +28,7 @@ void ClearPending() {
|
|||
if (PrintPending.offset != 0) {
|
||||
auto size = strlen(PrintBufArea.cast<char>().c() + sizeof(ListenerMessageHeader));
|
||||
if (size > 0) {
|
||||
printf("%s", PrintBufArea.cast<char>().c() + sizeof(ListenerMessageHeader));
|
||||
lg::print("{}", PrintBufArea.cast<char>().c() + sizeof(ListenerMessageHeader));
|
||||
}
|
||||
clear_print();
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ void InstallHandler(u32 handler_idx, u32 handler_func) {
|
|||
vif1_interrupt_handler = handler_func;
|
||||
break;
|
||||
default:
|
||||
printf("unknown handler: %d\n", handler_idx);
|
||||
lg::error("unknown handler: {}\n", handler_idx);
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "common/cross_os_debug/xdbg.h"
|
||||
#include "common/listener_common.h"
|
||||
#include "common/log/log.h"
|
||||
|
||||
#include "game/kernel/common/Ptr.h"
|
||||
#include "game/kernel/common/fileio.h"
|
||||
|
@ -186,37 +187,37 @@ void cprintf(const char* format, ...) {
|
|||
/*!
|
||||
* Print directly to the C stdout
|
||||
* The "k" parameter is ignored, so this is just like printf
|
||||
* DONE, EXACT
|
||||
* DONE, changed vprintf to lg::printstd
|
||||
*/
|
||||
void Msg(s32 k, const char* format, ...) {
|
||||
(void)k;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
lg::printstd(format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Print directly to the C stdout
|
||||
* This is idential to Msg
|
||||
* DONE, EXACT
|
||||
* DONE, changed vprintf to lg::printstd
|
||||
*/
|
||||
void MsgWarn(const char* format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
lg::printstd(format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Print directly to the C stdout
|
||||
* This is idential to Msg
|
||||
* DONE, EXACT
|
||||
* DONE, changed vprintf to lg::printstd
|
||||
*/
|
||||
void MsgErr(const char* format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
lg::printstd(format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
@ -572,4 +573,4 @@ char* kitoa(char* buffer, s64 value, u64 base, s32 length, char pad, u32 flag) {
|
|||
*/
|
||||
void kqtoa() {
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <thread>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/log/log.h"
|
||||
#include "common/util/Timer.h"
|
||||
|
||||
#include "game/common/game_common_types.h"
|
||||
|
@ -140,7 +141,7 @@ void KernelCheckAndDispatch() {
|
|||
|
||||
auto time_ms = kernel_dispatch_timer.getMs();
|
||||
if (time_ms > 50) {
|
||||
printf("Kernel dispatch time: %.3f ms\n", time_ms);
|
||||
lg::print("Kernel dispatch time: {:.3f} ms\n", time_ms);
|
||||
}
|
||||
|
||||
ClearPending();
|
||||
|
@ -163,4 +164,4 @@ void KernelCheckAndDispatch() {
|
|||
void KernelShutdown() {
|
||||
MasterExit = RuntimeExitStatus::EXIT; // GOAL Kernel Dispatch loop will stop now.
|
||||
}
|
||||
} // namespace jak1
|
||||
} // namespace jak1
|
||||
|
|
|
@ -390,7 +390,7 @@ u64 kopen(u64 fs, u64 name, u64 mode) {
|
|||
file_stream->mode = mode;
|
||||
file_stream->name = name;
|
||||
file_stream->flags = 0;
|
||||
printf("****** CALL TO kopen() ******\n");
|
||||
lg::print("****** CALL TO kopen() ******\n");
|
||||
char buffer[128];
|
||||
// sprintf(buffer, "host:%s", Ptr<String>(name)->data());
|
||||
sprintf(buffer, "%s", Ptr<String>(name)->data());
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <cstring>
|
||||
|
||||
#include "common/listener_common.h"
|
||||
#include "common/log/log.h"
|
||||
#include "common/symbols.h"
|
||||
|
||||
#include "game/kernel/common/Ptr.h"
|
||||
|
@ -508,8 +509,9 @@ s32 format_impl_jak1(uint64_t* args) {
|
|||
*PrintPendingLocal3 = 0;
|
||||
return string;
|
||||
} else if (original_dest == 0) {
|
||||
printf("%s", PrintPendingLocal3);
|
||||
fflush(stdout);
|
||||
lg::print("{}", PrintPendingLocal3);
|
||||
// printf("%s", PrintPendingLocal3);
|
||||
// fflush(stdout);
|
||||
PrintPending = make_ptr(PrintPendingLocal2).cast<u8>();
|
||||
*PrintPendingLocal3 = 0;
|
||||
return 0;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <cstring>
|
||||
|
||||
#include "common/goal_constants.h"
|
||||
#include "common/log/log.h"
|
||||
#include "common/repl/util.h"
|
||||
#include "common/util/Timer.h"
|
||||
|
||||
|
@ -120,7 +121,7 @@ void KernelDispatch(u32 dispatcher_func) {
|
|||
|
||||
float time_ms = dispatch_timer.getMs();
|
||||
if (time_ms > 50) {
|
||||
printf("Kernel dispatch time: %.3f ms\n", time_ms);
|
||||
lg::print("Kernel dispatch time: {:.3f} ms\n", time_ms);
|
||||
}
|
||||
|
||||
// flush stdout
|
||||
|
|
|
@ -505,7 +505,7 @@ u64 kopen(u64 fs, u64 name, u64 mode) {
|
|||
file_stream->mode = mode;
|
||||
file_stream->name = name;
|
||||
file_stream->flags = 0;
|
||||
printf("****** CALL TO kopen() ******\n");
|
||||
lg::print("****** CALL TO kopen() ******\n");
|
||||
char buffer[128];
|
||||
// sprintf(buffer, "host:%s", Ptr<String>(name)->data());
|
||||
sprintf(buffer, "%s", Ptr<String>(name)->data());
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "common/goal_constants.h"
|
||||
#include "common/listener_common.h"
|
||||
#include "common/log/log.h"
|
||||
#include "common/symbols.h"
|
||||
|
||||
#include "game/kernel/common/fileio.h"
|
||||
|
@ -544,8 +545,9 @@ s32 format_impl_jak2(uint64_t* args) {
|
|||
if (DiskBoot) {
|
||||
// however, we are going to disable it anyway because it spams the console and is annoying
|
||||
if (false) {
|
||||
printf("%s", PrintPendingLocal3);
|
||||
fflush(stdout);
|
||||
lg::print("{}", PrintPendingLocal3);
|
||||
// printf("%s", PrintPendingLocal3);
|
||||
// fflush(stdout);
|
||||
}
|
||||
PrintPending = make_ptr(PrintPendingLocal2).cast<u8>();
|
||||
// if we don't comment this line, our output gets cleared
|
||||
|
@ -560,8 +562,9 @@ s32 format_impl_jak2(uint64_t* args) {
|
|||
*PrintPendingLocal3 = 0;
|
||||
return string;
|
||||
} else if (original_dest == 0) {
|
||||
printf("%s", PrintPendingLocal3);
|
||||
fflush(stdout);
|
||||
lg::print("{}", PrintPendingLocal3);
|
||||
// printf("%s", PrintPendingLocal3);
|
||||
// fflush(stdout);
|
||||
PrintPending = make_ptr(PrintPendingLocal2).cast<u8>();
|
||||
*PrintPendingLocal3 = 0;
|
||||
return 0;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <cstring>
|
||||
|
||||
#include "common/log/log.h"
|
||||
#include "common/repl/util.h"
|
||||
#include "common/util/Timer.h"
|
||||
|
||||
|
@ -124,7 +125,7 @@ void KernelDispatch(u32 dispatcher_func) {
|
|||
|
||||
float time_ms = dispatch_timer.getMs();
|
||||
if (time_ms > 50) {
|
||||
printf("Kernel dispatch time: %.3f ms\n", time_ms);
|
||||
lg::print("Kernel dispatch time: {:.3f} ms\n", time_ms);
|
||||
}
|
||||
|
||||
// flush stdout
|
||||
|
@ -160,4 +161,4 @@ void KernelCheckAndDispatch() {
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace jak3
|
||||
} // namespace jak3
|
||||
|
|
|
@ -319,7 +319,7 @@ u64 kopen(u64 fs, u64 name, u64 mode) {
|
|||
file_stream->mode = mode;
|
||||
file_stream->name = name;
|
||||
file_stream->flags = 0;
|
||||
printf("****** CALL TO kopen() ******\n");
|
||||
lg::print("****** CALL TO kopen() ******\n");
|
||||
char buffer[128];
|
||||
// sprintf(buffer, "host:%s", Ptr<String>(name)->data());
|
||||
sprintf(buffer, "%s", Ptr<String>(name)->data());
|
||||
|
@ -510,4 +510,4 @@ void InitMachineScheme() {
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace jak3
|
||||
} // namespace jak3
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "common/goal_constants.h"
|
||||
#include "common/listener_common.h"
|
||||
#include "common/log/log.h"
|
||||
#include "common/symbols.h"
|
||||
|
||||
#include "game/kernel/common/fileio.h"
|
||||
|
@ -514,8 +515,9 @@ s32 format_impl_jak3(uint64_t* args) {
|
|||
if (DiskBoot) {
|
||||
// however, we are going to disable it anyway because it spams the console and is annoying
|
||||
if (false) {
|
||||
printf("%s", PrintPendingLocal3);
|
||||
fflush(stdout);
|
||||
lg::print("{}", PrintPendingLocal3);
|
||||
// printf("%s", PrintPendingLocal3);
|
||||
// fflush(stdout);
|
||||
}
|
||||
PrintPending = make_ptr(PrintPendingLocal2).cast<u8>();
|
||||
// if we don't comment this line, our output gets cleared
|
||||
|
@ -530,8 +532,9 @@ s32 format_impl_jak3(uint64_t* args) {
|
|||
*PrintPendingLocal3 = 0;
|
||||
return string;
|
||||
} else if (original_dest == 0) {
|
||||
printf("%s", PrintPendingLocal3);
|
||||
fflush(stdout);
|
||||
lg::print("{}", PrintPendingLocal3);
|
||||
// printf("%s", PrintPendingLocal3);
|
||||
// fflush(stdout);
|
||||
PrintPending = make_ptr(PrintPendingLocal2).cast<u8>();
|
||||
*PrintPendingLocal3 = 0;
|
||||
return 0;
|
||||
|
|
|
@ -109,7 +109,7 @@ FileRecord* FS_FindIN(const char* iso_name) {
|
|||
}
|
||||
count++;
|
||||
}
|
||||
printf("[FAKEISO] failed to find %s\n", iso_name);
|
||||
lg::error("[FAKEISO] failed to find {}\n", iso_name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue