mirror of https://github.com/PCSX2/pcsx2.git
zzogl-pg: Start reworking the way logging works.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2899 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
92a8baab56
commit
0ccd832efe
|
@ -134,35 +134,165 @@ bool THR_bShift = false;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void __Log(const char *fmt, ...)
|
namespace ZZLog
|
||||||
{
|
{
|
||||||
va_list list;
|
bool IsLogging()
|
||||||
|
{
|
||||||
|
// gsLog can be null if the config dialog is used prior to Pcsx2 starting an emulation session.
|
||||||
|
// (GSinit won't have been called then)
|
||||||
|
return (gsLog != NULL && conf.log);
|
||||||
|
}
|
||||||
|
void _Message(const char *str)
|
||||||
|
{
|
||||||
|
SysMessage(str);
|
||||||
|
}
|
||||||
|
|
||||||
// gsLog can be null if the config dialog is used prior to Pcsx2 an emulation session.
|
void _Log(const char *str)
|
||||||
// (GSinit won't have been called then)
|
{
|
||||||
|
if (IsLogging()) fprintf(gsLog, str);
|
||||||
|
}
|
||||||
|
|
||||||
if (gsLog == NULL || !conf.log) return;
|
void _WriteToConsole(const char *str)
|
||||||
|
{
|
||||||
|
printf("ZZogl-PG: %s", str);
|
||||||
|
}
|
||||||
|
|
||||||
va_start(list, fmt);
|
void _Print(const char *str)
|
||||||
vfprintf(gsLog, fmt, list);
|
{
|
||||||
va_end(list);
|
printf("ZZogl-PG: %s", str);
|
||||||
}
|
if (IsLogging()) fprintf(gsLog, str);
|
||||||
|
}
|
||||||
|
|
||||||
void __LogToConsole(const char *fmt, ...) {
|
void Message(const char *fmt, ...)
|
||||||
va_list list;
|
{
|
||||||
|
va_list list;
|
||||||
|
char tmp[512];
|
||||||
|
|
||||||
va_start(list, fmt);
|
va_start(list, fmt);
|
||||||
|
vsprintf(tmp, fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
// gsLog can be null if the config dialog is used prior to Pcsx2 an emulation session.
|
SysMessage(tmp);
|
||||||
// (GSinit won't have been called then)
|
}
|
||||||
|
|
||||||
if( gsLog != NULL )
|
void Log(const char *fmt, ...)
|
||||||
vfprintf(gsLog, fmt, list);
|
{
|
||||||
|
va_list list;
|
||||||
|
|
||||||
printf("ZZogl: ");
|
va_start(list, fmt);
|
||||||
vprintf(fmt, list);
|
if (IsLogging()) vfprintf(gsLog, fmt, list);
|
||||||
va_end(list);
|
va_end(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WriteToConsole(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list list;
|
||||||
|
|
||||||
|
va_start(list, fmt);
|
||||||
|
|
||||||
|
printf("ZZogl-PG: ");
|
||||||
|
vprintf(fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Print(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list list;
|
||||||
|
|
||||||
|
va_start(list, fmt);
|
||||||
|
if (IsLogging()) vfprintf(gsLog, fmt, list);
|
||||||
|
printf("ZZogl-PG: ");
|
||||||
|
vprintf(fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Greg_Log(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// Not currently used
|
||||||
|
#if 0
|
||||||
|
va_list list;
|
||||||
|
char tmp[512];
|
||||||
|
|
||||||
|
va_start(list, fmt);
|
||||||
|
if (IsLogging()) vfprintf(gsLog, fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Prim_Log(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
#if ZEROGS_DEVBUILD
|
||||||
|
va_list list;
|
||||||
|
char tmp[512];
|
||||||
|
|
||||||
|
va_start(list, fmt);
|
||||||
|
|
||||||
|
if (conf.log /*& 0x00000010*/)
|
||||||
|
{
|
||||||
|
if (IsLogging()) vfprintf(gsLog, fmt, list);
|
||||||
|
|
||||||
|
printf("ZZogl-PG(PRIM): ");
|
||||||
|
vprintf(fmt, list);
|
||||||
|
}
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void GS_Log(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
#if ZEROGS_DEVBUILD
|
||||||
|
va_list list;
|
||||||
|
|
||||||
|
va_start(list,fmt);
|
||||||
|
|
||||||
|
if (IsLogging()) vfprintf(gsLog, fmt, list);
|
||||||
|
printf("ZZogl-PG(GS): ");
|
||||||
|
vprintf(fmt,list);
|
||||||
|
va_end(list);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Warn_Log(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
#if ZEROGS_DEVBUILD
|
||||||
|
va_list list;
|
||||||
|
|
||||||
|
va_start(list,fmt);
|
||||||
|
if (IsLogging()) vfprintf(gsLog, fmt, list);
|
||||||
|
printf("ZZogl-PG(Warning): ");
|
||||||
|
vprintf(fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Debug_Log(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
#if _DEBUG
|
||||||
|
va_list list;
|
||||||
|
|
||||||
|
va_start(list,fmt);
|
||||||
|
if (IsLogging()) vfprintf(gsLog, fmt, list);
|
||||||
|
printf("ZZogl-PG(Debug): ");
|
||||||
|
vprintf(fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Error_Log(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list list;
|
||||||
|
|
||||||
|
va_start(list,fmt);
|
||||||
|
|
||||||
|
if (IsLogging()) vfprintf(gsLog, fmt, list);
|
||||||
|
printf("ZZogl-PG(Error): ");
|
||||||
|
vprintf(fmt,list);
|
||||||
|
va_end(list);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void CALLBACK GSsetBaseMem(void* pmem) {
|
void CALLBACK GSsetBaseMem(void* pmem) {
|
||||||
g_pBasePS2Mem = (u8*)pmem;
|
g_pBasePS2Mem = (u8*)pmem;
|
||||||
|
@ -688,7 +818,7 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread)
|
||||||
GLWin.CreateWindow(pDsp);
|
GLWin.CreateWindow(pDsp);
|
||||||
|
|
||||||
ERROR_LOG("Using %s:%d.%d.%d\n", libraryName, zgsrevision, zgsbuild, zgsminor);
|
ERROR_LOG("Using %s:%d.%d.%d\n", libraryName, zgsrevision, zgsbuild, zgsminor);
|
||||||
ERROR_LOG("creating zerogs\n");
|
ERROR_LOG("Creating zerogs\n");
|
||||||
//if (conf.record) recOpen();
|
//if (conf.record) recOpen();
|
||||||
if (!ZeroGS::Create(conf.width, conf.height)) return -1;
|
if (!ZeroGS::Create(conf.width, conf.height)) return -1;
|
||||||
|
|
||||||
|
@ -834,7 +964,7 @@ void CALLBACK GSvsync(int interlace)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
GS_LOG("\nGSvsync\n\n");
|
//GS_LOG("GSvsync\n");
|
||||||
|
|
||||||
static u32 dwTime = timeGetTime();
|
static u32 dwTime = timeGetTime();
|
||||||
static int nToNextUpdate = 1;
|
static int nToNextUpdate = 1;
|
||||||
|
|
|
@ -74,7 +74,7 @@ extern HANDLE g_hCurrentThread;
|
||||||
__forceinline void gifTransferLog(int index, u32 *pMem, u32 size)
|
__forceinline void gifTransferLog(int index, u32 *pMem, u32 size)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if( conf.log & 0x20 )
|
if( conf.log /*& 0x20*/ )
|
||||||
{
|
{
|
||||||
static int nSaveIndex = 0;
|
static int nSaveIndex = 0;
|
||||||
GS_LOG("%d: p:%d %x\n", nSaveIndex++, index + 1, size);
|
GS_LOG("%d: p:%d %x\n", nSaveIndex++, index + 1, size);
|
||||||
|
|
|
@ -41,6 +41,9 @@ void SaveConfig()
|
||||||
fprintf(f, "bilinear = %hhx\n", conf.bilinear);
|
fprintf(f, "bilinear = %hhx\n", conf.bilinear);
|
||||||
fprintf(f, "aliasing = %hhx\n", conf.aa);
|
fprintf(f, "aliasing = %hhx\n", conf.aa);
|
||||||
fprintf(f, "gamesettings = %x\n", conf.gamesettings); //u32
|
fprintf(f, "gamesettings = %x\n", conf.gamesettings); //u32
|
||||||
|
fprintf(f, "width = %x\n", conf.width); //u32
|
||||||
|
fprintf(f, "height = %x\n", conf.height); //u32
|
||||||
|
fprintf(f, "log = %x\n", conf.log); //u32
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +58,7 @@ void LoadConfig()
|
||||||
conf.width = 640;
|
conf.width = 640;
|
||||||
conf.height = 480;
|
conf.height = 480;
|
||||||
conf.aa = 0;
|
conf.aa = 0;
|
||||||
|
conf.log = 1;
|
||||||
|
|
||||||
const std::string iniFile( s_strIniPath + "zzogl-pg.ini" );
|
const std::string iniFile( s_strIniPath + "zzogl-pg.ini" );
|
||||||
FILE* f = fopen(iniFile.c_str(), "r");
|
FILE* f = fopen(iniFile.c_str(), "r");
|
||||||
|
@ -70,6 +74,9 @@ void LoadConfig()
|
||||||
err = fscanf(f, "bilinear = %hhx\n", &conf.bilinear);
|
err = fscanf(f, "bilinear = %hhx\n", &conf.bilinear);
|
||||||
err = fscanf(f, "aliasing = %hhx\n", &conf.aa);
|
err = fscanf(f, "aliasing = %hhx\n", &conf.aa);
|
||||||
err = fscanf(f, "gamesettings = %x\n", &conf.gamesettings);//u32
|
err = fscanf(f, "gamesettings = %x\n", &conf.gamesettings);//u32
|
||||||
|
err = fscanf(f, "width = %x\n", &conf.width);//u32
|
||||||
|
err = fscanf(f, "height = %x\n", &conf.height);//u32
|
||||||
|
err = fscanf(f, "log = %x\n", &conf.log);//u32
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
// filter bad files
|
// filter bad files
|
||||||
|
|
|
@ -199,6 +199,7 @@ void DisplayDialog()
|
||||||
GtkWidget *main_frame, *main_box;
|
GtkWidget *main_frame, *main_box;
|
||||||
|
|
||||||
GtkWidget *option_frame, *option_box;
|
GtkWidget *option_frame, *option_box;
|
||||||
|
GtkWidget *log_check;
|
||||||
GtkWidget *int_label, *int_box;
|
GtkWidget *int_label, *int_box;
|
||||||
GtkWidget *bilinear_check, *bilinear_label;
|
GtkWidget *bilinear_check, *bilinear_label;
|
||||||
GtkWidget *aa_label, *aa_box;
|
GtkWidget *aa_label, *aa_box;
|
||||||
|
@ -224,6 +225,7 @@ void DisplayDialog()
|
||||||
GTK_RESPONSE_ACCEPT,
|
GTK_RESPONSE_ACCEPT,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
log_check = gtk_check_button_new_with_label("Logging (For Debugging):");
|
||||||
int_label = gtk_label_new ("Interlacing: (F5 to toggle)");
|
int_label = gtk_label_new ("Interlacing: (F5 to toggle)");
|
||||||
int_box = gtk_combo_box_new_text ();
|
int_box = gtk_combo_box_new_text ();
|
||||||
gtk_combo_box_append_text(GTK_COMBO_BOX(int_box), "No Interlacing");
|
gtk_combo_box_append_text(GTK_COMBO_BOX(int_box), "No Interlacing");
|
||||||
|
@ -281,6 +283,7 @@ void DisplayDialog()
|
||||||
advanced_scroll = gtk_scrolled_window_new(NULL, NULL);
|
advanced_scroll = gtk_scrolled_window_new(NULL, NULL);
|
||||||
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(advanced_scroll), tree);
|
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(advanced_scroll), tree);
|
||||||
|
|
||||||
|
gtk_box_pack_start(GTK_BOX(option_box), log_check, false, false, 2);
|
||||||
gtk_box_pack_start(GTK_BOX(option_box), int_label, false, false, 2);
|
gtk_box_pack_start(GTK_BOX(option_box), int_label, false, false, 2);
|
||||||
gtk_box_pack_start(GTK_BOX(option_box), int_box, false, false, 2);
|
gtk_box_pack_start(GTK_BOX(option_box), int_box, false, false, 2);
|
||||||
gtk_box_pack_start(GTK_BOX(option_box), bilinear_check, false, false, 2);
|
gtk_box_pack_start(GTK_BOX(option_box), bilinear_check, false, false, 2);
|
||||||
|
@ -301,6 +304,7 @@ void DisplayDialog()
|
||||||
gtk_box_pack_start(GTK_BOX(main_box), option_frame, false, false, 2);
|
gtk_box_pack_start(GTK_BOX(main_box), option_frame, false, false, 2);
|
||||||
gtk_box_pack_start(GTK_BOX(main_box), advanced_frame, true, true, 2);
|
gtk_box_pack_start(GTK_BOX(main_box), advanced_frame, true, true, 2);
|
||||||
|
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_check), conf.log);
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bilinear_check), conf.bilinear);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bilinear_check), conf.bilinear);
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wireframe_check), (conf.options & GSOPTION_WIREFRAME));
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wireframe_check), (conf.options & GSOPTION_WIREFRAME));
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(avi_check), (conf.options & GSOPTION_CAPTUREAVI));
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(avi_check), (conf.options & GSOPTION_CAPTUREAVI));
|
||||||
|
@ -333,6 +337,7 @@ void DisplayDialog()
|
||||||
case 3: fake_options |= GSOPTION_WIN1280; break;
|
case 3: fake_options |= GSOPTION_WIN1280; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conf.log = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_check));
|
||||||
conf.bilinear = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bilinear_check));
|
conf.bilinear = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bilinear_check));
|
||||||
|
|
||||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wireframe_check)))
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wireframe_check)))
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<Option compiler="gcc" />
|
<Option compiler="gcc" />
|
||||||
<Build>
|
<Build>
|
||||||
<Target title="Debug">
|
<Target title="Debug">
|
||||||
<Option output="../../../../../bin/plugins/ZZOgl-PG-d.so" prefix_auto="0" extension_auto="0" />
|
<Option output="../../../../../bin/plugins/ZZOgl-PG-dbg.so" prefix_auto="0" extension_auto="0" />
|
||||||
<Option object_output="obj/Debug/" />
|
<Option object_output="obj/Debug/" />
|
||||||
<Option type="3" />
|
<Option type="3" />
|
||||||
<Option compiler="gcc" />
|
<Option compiler="gcc" />
|
||||||
|
@ -16,11 +16,28 @@
|
||||||
<Compiler>
|
<Compiler>
|
||||||
<Add option="-Wall" />
|
<Add option="-Wall" />
|
||||||
<Add option="-g" />
|
<Add option="-g" />
|
||||||
|
<Add option="-D_DEBUG" />
|
||||||
</Compiler>
|
</Compiler>
|
||||||
<Linker>
|
<Linker>
|
||||||
<Add library="../../../../../deps/debug/libUtilities.a" />
|
<Add library="../../../../../deps/debug/libUtilities.a" />
|
||||||
</Linker>
|
</Linker>
|
||||||
</Target>
|
</Target>
|
||||||
|
<Target title="Devel">
|
||||||
|
<Option output="../../../../../bin/plugins/ZZOgl-PG-dev" prefix_auto="1" extension_auto="1" />
|
||||||
|
<Option object_output="obj/Release/" />
|
||||||
|
<Option type="3" />
|
||||||
|
<Option compiler="gcc" />
|
||||||
|
<Option createDefFile="1" />
|
||||||
|
<Option createStaticLib="1" />
|
||||||
|
<Compiler>
|
||||||
|
<Add option="-W" />
|
||||||
|
<Add option="-g" />
|
||||||
|
<Add option="-DZEROGS_DEVBUILD" />
|
||||||
|
</Compiler>
|
||||||
|
<Linker>
|
||||||
|
<Add library="../../../../../deps/release/libUtilities.a" />
|
||||||
|
</Linker>
|
||||||
|
</Target>
|
||||||
<Target title="Release">
|
<Target title="Release">
|
||||||
<Option output="../../../../../bin/plugins/ZZOgl-PG" prefix_auto="1" extension_auto="1" />
|
<Option output="../../../../../bin/plugins/ZZOgl-PG" prefix_auto="1" extension_auto="1" />
|
||||||
<Option object_output="obj/Release/" />
|
<Option object_output="obj/Release/" />
|
||||||
|
@ -31,6 +48,7 @@
|
||||||
<Compiler>
|
<Compiler>
|
||||||
<Add option="-O2" />
|
<Add option="-O2" />
|
||||||
<Add option="-W" />
|
<Add option="-W" />
|
||||||
|
<Add option="-DRELEASE_TO_PUBLIC" />
|
||||||
</Compiler>
|
</Compiler>
|
||||||
<Linker>
|
<Linker>
|
||||||
<Add option="-s" />
|
<Add option="-s" />
|
||||||
|
|
|
@ -73,15 +73,6 @@ extern std::string s_strIniPath; // Air's new (r2361) new constant for ini file
|
||||||
// fixme - We should use ZEROGS_DEVBUILD to determine devel/debug builds from "public release" builds.
|
// fixme - We should use ZEROGS_DEVBUILD to determine devel/debug builds from "public release" builds.
|
||||||
// Means a lot of search-and-replace though. (air)
|
// Means a lot of search-and-replace though. (air)
|
||||||
|
|
||||||
#ifdef ZEROGS_DEVBUILD
|
|
||||||
#define GS_LOG __Log
|
|
||||||
#else
|
|
||||||
#define GS_LOG 0&&
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ERROR_LOG __LogToConsole
|
|
||||||
//Logging for errors that are called often should have a time counter.
|
|
||||||
|
|
||||||
#if !defined(_MSC_VER) && !defined(HAVE_ALIGNED_MALLOC)
|
#if !defined(_MSC_VER) && !defined(HAVE_ALIGNED_MALLOC)
|
||||||
|
|
||||||
// declare linux equivalents
|
// declare linux equivalents
|
||||||
|
@ -178,11 +169,10 @@ typedef struct
|
||||||
u32 gamesettings;// default game settings
|
u32 gamesettings;// default game settings
|
||||||
int width, height; // View target size, has no impact towards speed
|
int width, height; // View target size, has no impact towards speed
|
||||||
bool isWideScreen; // Widescreen support
|
bool isWideScreen; // Widescreen support
|
||||||
#ifdef GS_LOG
|
|
||||||
u32 log;
|
u32 log;
|
||||||
#endif
|
|
||||||
} GSconf;
|
} GSconf;
|
||||||
|
|
||||||
|
//Logging for errors that are called often should have a time counter.
|
||||||
#ifdef __LINUX__
|
#ifdef __LINUX__
|
||||||
static u32 __attribute__((unused)) lasttime = 0;
|
static u32 __attribute__((unused)) lasttime = 0;
|
||||||
static u32 __attribute__((unused)) BigTime = 5000;
|
static u32 __attribute__((unused)) BigTime = 5000;
|
||||||
|
@ -236,25 +226,31 @@ static bool SPAM_PASS;
|
||||||
#define FUNCLOG
|
#define FUNCLOG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEBUG_LOG printf
|
extern void __LogToConsole(const char *fmt, ...);
|
||||||
|
|
||||||
#ifdef RELEASE_TO_PUBLIC
|
namespace ZZLog
|
||||||
#define WARN_LOG 0&&
|
{
|
||||||
#define PRIM_LOG 0&&
|
extern void Message(const char *fmt, ...);
|
||||||
#else
|
extern void Log(const char *fmt, ...);
|
||||||
#define WARN_LOG printf
|
extern void WriteToConsole(const char *fmt, ...);
|
||||||
#define PRIM_LOG if (conf.log & 0x00000010) GS_LOG
|
extern void Print(const char *fmt, ...);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GREG_LOG
|
extern void Greg_Log(const char *fmt, ...);
|
||||||
#define GREG_LOG 0&&
|
extern void Prim_Log(const char *fmt, ...);
|
||||||
#endif
|
extern void GS_Log(const char *fmt, ...);
|
||||||
#ifndef PRIM_LOG
|
|
||||||
#define PRIM_LOG 0&&
|
extern void Debug_Log(const char *fmt, ...);
|
||||||
#endif
|
extern void Warn_Log(const char *fmt, ...);
|
||||||
#ifndef WARN_LOG
|
extern void Error_Log(const char *fmt, ...);
|
||||||
#define WARN_LOG 0&&
|
};
|
||||||
#endif
|
|
||||||
|
#define GREG_LOG ZZLog::Greg_Log
|
||||||
|
#define PRIM_LOG ZZLog::Prim_Log
|
||||||
|
#define WARN_LOG ZZLog::Warn_Log
|
||||||
|
#define GS_LOG ZZLog::GS_Log
|
||||||
|
#define DEBUG_LOG ZZLog::Debug_Log
|
||||||
|
#define ERROR_LOG ZZLog::Error_Log
|
||||||
|
//ZZLog::Error_Log
|
||||||
|
|
||||||
|
|
||||||
#define REG64(name) \
|
#define REG64(name) \
|
||||||
|
@ -291,12 +287,6 @@ union name \
|
||||||
|
|
||||||
#define REG_SET_END };
|
#define REG_SET_END };
|
||||||
|
|
||||||
|
|
||||||
extern FILE *gsLog;
|
|
||||||
|
|
||||||
extern void __Log(const char *fmt, ...);
|
|
||||||
extern void __LogToConsole(const char *fmt, ...);
|
|
||||||
|
|
||||||
extern void LoadConfig();
|
extern void LoadConfig();
|
||||||
extern void SaveConfig();
|
extern void SaveConfig();
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,9 @@ BOOL CALLBACK LoggingDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case IDOK:
|
case IDOK:
|
||||||
if (IsDlgButtonChecked(hW, IDC_LOG))
|
if (IsDlgButtonChecked(hW, IDC_LOG))
|
||||||
conf.log = 1;
|
conf.log = 1;
|
||||||
else conf.log = 0;
|
else
|
||||||
|
conf.log = 0;
|
||||||
|
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
EndDialog(hW, FALSE);
|
EndDialog(hW, FALSE);
|
||||||
|
|
|
@ -148,20 +148,29 @@ void ZeroGS::AdjustTransToAspect(Vector& v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper for skip frames.
|
// Helper for skip frames.
|
||||||
int TimeLastSkip=0;
|
int TimeLastSkip = 0;
|
||||||
inline bool FrameSkippingHelper() {
|
|
||||||
|
inline bool FrameSkippingHelper()
|
||||||
|
{
|
||||||
bool ShouldSkip = false;
|
bool ShouldSkip = false;
|
||||||
if( g_nFrameRender > 0 ) {
|
|
||||||
if( g_nFrameRender < 8 ) {
|
if (g_nFrameRender > 0)
|
||||||
|
{
|
||||||
|
if (g_nFrameRender < 8)
|
||||||
|
{
|
||||||
g_nFrameRender++;
|
g_nFrameRender++;
|
||||||
if( g_nFrameRender <= 3 ) {
|
|
||||||
|
if (g_nFrameRender <= 3)
|
||||||
|
{
|
||||||
g_nFramesSkipped++;
|
g_nFramesSkipped++;
|
||||||
ShouldSkip = true;
|
ShouldSkip = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
if( g_nFrameRender < -1 ) {
|
{
|
||||||
|
if (g_nFrameRender < -1)
|
||||||
|
{
|
||||||
g_nFramesSkipped++;
|
g_nFramesSkipped++;
|
||||||
ShouldSkip = true;
|
ShouldSkip = true;
|
||||||
}
|
}
|
||||||
|
@ -446,10 +455,11 @@ inline Vector RenderSetTargetBitTex(float th, float tw, float dh, float dw, bool
|
||||||
Vector v;
|
Vector v;
|
||||||
v = Vector(th, tw, dh, dw);
|
v = Vector(th, tw, dh, dw);
|
||||||
|
|
||||||
// Incorrect Asect ration on interlaced frames
|
// Incorrect Aspect ratio on interlaced frames
|
||||||
if (isInterlace) {
|
if (isInterlace)
|
||||||
v.y -= 1.0f/480 ;
|
{
|
||||||
v.w += 1.0f/480 ;
|
v.y -= 1.0f/conf.height;
|
||||||
|
v.w += 1.0f/conf.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZZcgSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
|
ZZcgSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
|
||||||
|
|
|
@ -142,7 +142,7 @@ float fiRendWidth, fiRendHeight;
|
||||||
u8* s_lpShaderResources = NULL;
|
u8* s_lpShaderResources = NULL;
|
||||||
CGprogram pvs[16] = {NULL};
|
CGprogram pvs[16] = {NULL};
|
||||||
|
|
||||||
// String's for shader file in developer's mode
|
// String's for shader file in developer mode
|
||||||
#ifdef DEVBUILD
|
#ifdef DEVBUILD
|
||||||
char* EFFECT_NAME="";
|
char* EFFECT_NAME="";
|
||||||
char* EFFECT_DIR="";
|
char* EFFECT_DIR="";
|
||||||
|
@ -203,7 +203,7 @@ ZeroGS::Create_Window(int _width, int _height) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function ask about differnt OGL extensions, that are required to setup accordingly. Return false if cheks failed
|
// Function asks about different OGL extensions, that are required to setup accordingly. Return false if checks failed
|
||||||
inline bool ZeroGS::CreateImportantCheck() {
|
inline bool ZeroGS::CreateImportantCheck() {
|
||||||
bool bSuccess = true;
|
bool bSuccess = true;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -224,7 +224,7 @@ inline bool ZeroGS::CreateImportantCheck() {
|
||||||
bSuccess = false;
|
bSuccess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the effect, find the best profiles (if any)
|
// load the effect & find the best profiles (if any)
|
||||||
if( cgGLIsProfileSupported(CG_PROFILE_ARBVP1) != CG_TRUE ) {
|
if( cgGLIsProfileSupported(CG_PROFILE_ARBVP1) != CG_TRUE ) {
|
||||||
ERROR_LOG("arbvp1 not supported\n");
|
ERROR_LOG("arbvp1 not supported\n");
|
||||||
bSuccess = false;
|
bSuccess = false;
|
||||||
|
@ -237,7 +237,7 @@ inline bool ZeroGS::CreateImportantCheck() {
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is check for less important open gl extensions.
|
// This is a check for less important open gl extensions.
|
||||||
inline void ZeroGS::CreateOtherCheck() {
|
inline void ZeroGS::CreateOtherCheck() {
|
||||||
if( !IsGLExt("GL_EXT_blend_equation_separate") || glBlendEquationSeparateEXT == NULL ) {
|
if( !IsGLExt("GL_EXT_blend_equation_separate") || glBlendEquationSeparateEXT == NULL ) {
|
||||||
ERROR_LOG("*********\nZZogl: OGL WARNING: Need GL_EXT_blend_equation_separate\nZZogl: *********\n");
|
ERROR_LOG("*********\nZZogl: OGL WARNING: Need GL_EXT_blend_equation_separate\nZZogl: *********\n");
|
||||||
|
@ -274,9 +274,9 @@ inline void ZeroGS::CreateOtherCheck() {
|
||||||
|
|
||||||
glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, &Max_Texture_Size_NV);
|
glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, &Max_Texture_Size_NV);
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &Max_Texture_Size_2d);
|
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &Max_Texture_Size_2d);
|
||||||
ERROR_LOG("Maximun texture size is %d for Tex_2d and %d for Tex_NV\n", Max_Texture_Size_2d, Max_Texture_Size_NV);
|
ERROR_LOG("Maximum texture size is %d for Tex_2d and %d for Tex_NV\n", Max_Texture_Size_2d, Max_Texture_Size_NV);
|
||||||
if (Max_Texture_Size_NV < 1024)
|
if (Max_Texture_Size_NV < 1024)
|
||||||
ERROR_LOG("Could not properly made bitmasks, so some textures should be missed\n");
|
ERROR_LOG("Could not properly make bitmasks, so some textures will be missed\n");
|
||||||
|
|
||||||
/* Zeydlitz: we don't support 128-bit targets yet. they are slow and weirdo
|
/* Zeydlitz: we don't support 128-bit targets yet. they are slow and weirdo
|
||||||
if( g_GameSettings & GAME_32BITTARGS ) {
|
if( g_GameSettings & GAME_32BITTARGS ) {
|
||||||
|
@ -374,7 +374,18 @@ inline bool CreateFillExtensionsMap(){
|
||||||
|
|
||||||
int prevlog = conf.log;
|
int prevlog = conf.log;
|
||||||
conf.log = 1;
|
conf.log = 1;
|
||||||
GS_LOG("Supported OpenGL Extensions:\n%s\n", ptoken); // write to the log file
|
|
||||||
|
ZZLog::GS_Log("Supported OpenGL Extensions:\n%s\n", ptoken); // write to the log file
|
||||||
|
|
||||||
|
// Probably a better way to do it, but seems to crash.
|
||||||
|
/*int n;
|
||||||
|
glGetIntegerv(GL_NUM_EXTENSIONS, &n);
|
||||||
|
ZZLog::GS_Log("Supported OpenGL Extensions:\n");
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
ZZLog::GS_Log("%s/n", (const char*)glGetStringi(GL_EXTENSIONS, i));
|
||||||
|
}*/
|
||||||
|
|
||||||
conf.log = prevlog;
|
conf.log = prevlog;
|
||||||
|
|
||||||
// insert all exts into mapGLExtensions
|
// insert all exts into mapGLExtensions
|
||||||
|
@ -413,14 +424,10 @@ bool ZeroGS::Create(int _width, int _height)
|
||||||
cgSetErrorHandler(HandleCgError, NULL);
|
cgSetErrorHandler(HandleCgError, NULL);
|
||||||
g_RenderFormatType = RFT_float16;
|
g_RenderFormatType = RFT_float16;
|
||||||
|
|
||||||
if (!Create_Window(_width, _height))
|
if (!Create_Window(_width, _height)) return false;
|
||||||
return false;
|
if (!CreateFillExtensionsMap()) return false;
|
||||||
|
if (!CreateImportantCheck()) return false;
|
||||||
|
|
||||||
if (!CreateFillExtensionsMap())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!CreateImportantCheck())
|
|
||||||
return false;
|
|
||||||
ZeroGS::CreateOtherCheck();
|
ZeroGS::CreateOtherCheck();
|
||||||
|
|
||||||
// check the max texture width and height
|
// check the max texture width and height
|
||||||
|
@ -462,7 +469,7 @@ bool ZeroGS::Create(int _width, int _height)
|
||||||
|
|
||||||
glGenFramebuffersEXT( 1, &s_uFramebuffer);
|
glGenFramebuffersEXT( 1, &s_uFramebuffer);
|
||||||
if( s_uFramebuffer == 0 ) {
|
if( s_uFramebuffer == 0 ) {
|
||||||
ERROR_LOG("failed to create the renderbuffer\n");
|
ERROR_LOG("Failed to create the renderbuffer\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
assert( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT );
|
assert( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT );
|
||||||
|
|
|
@ -2286,7 +2286,7 @@ u32 ZeroGS::CBitwiseTextureMngr::GetTexInt(u32 bitvalue, u32 ptexDoNotDelete)
|
||||||
return ptex;
|
return ptex;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __forceinline void RangeSanityCheck()
|
void ZeroGS::CRangeManager::RangeSanityCheck()
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// sanity check
|
// sanity check
|
||||||
|
|
|
@ -168,6 +168,7 @@ namespace ZeroGS {
|
||||||
|
|
||||||
// works in semi logN
|
// works in semi logN
|
||||||
void Insert(int start, int end);
|
void Insert(int start, int end);
|
||||||
|
void RangeSanityCheck();
|
||||||
inline void Clear() {
|
inline void Clear() {
|
||||||
ranges.resize(0);
|
ranges.resize(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -780,13 +780,17 @@ void ZeroGS::KickDummy()
|
||||||
void ZeroGS::SetFogColor(u32 fog)
|
void ZeroGS::SetFogColor(u32 fog)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
if( 1||gs.fogcol != fog ) {
|
|
||||||
|
// Always set the fog color, even if it was already set.
|
||||||
|
// if (gs.fogcol != fog)
|
||||||
|
// {
|
||||||
gs.fogcol = fog;
|
gs.fogcol = fog;
|
||||||
|
|
||||||
ZeroGS::Flush(0);
|
ZeroGS::Flush(0);
|
||||||
ZeroGS::Flush(1);
|
ZeroGS::Flush(1);
|
||||||
|
|
||||||
if( !g_bIsLost ) {
|
if (!g_bIsLost)
|
||||||
|
{
|
||||||
SetShaderCaller("SetFogColor");
|
SetShaderCaller("SetFogColor");
|
||||||
Vector v;
|
Vector v;
|
||||||
|
|
||||||
|
@ -796,7 +800,7 @@ void ZeroGS::SetFogColor(u32 fog)
|
||||||
v.z = ((gs.fogcol>>16)&0xff)/255.0f;
|
v.z = ((gs.fogcol>>16)&0xff)/255.0f;
|
||||||
ZZcgSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor");
|
ZZcgSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor");
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::ExtWrite()
|
void ZeroGS::ExtWrite()
|
||||||
|
|
Loading…
Reference in New Issue