parent
2f0921ecd1
commit
611477e9e7
|
@ -23,6 +23,11 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
/////// Console vars
|
||||||
|
#define BUFFER_SIZE 100
|
||||||
|
HANDLE hConsole;
|
||||||
|
///////
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Debug * DebugInit(const char * n, DebugOutType t, char * s) {
|
Debug * DebugInit(const char * n, DebugOutType t, char * s) {
|
||||||
|
@ -158,3 +163,53 @@ void LogStop(void) {
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////// Console
|
||||||
|
#ifdef WIN32
|
||||||
|
void OpenConsole()
|
||||||
|
{
|
||||||
|
COORD csize;
|
||||||
|
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
|
||||||
|
SMALL_RECT srect;
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
|
if (hConsole) return;
|
||||||
|
AllocConsole();
|
||||||
|
memset(buf,0,256);
|
||||||
|
sprintf(buf,"DeSmuME v%s OUTPUT", VERSION);
|
||||||
|
SetConsoleTitle(TEXT(buf));
|
||||||
|
csize.X = 60;
|
||||||
|
csize.Y = 800;
|
||||||
|
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), csize);
|
||||||
|
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbiInfo);
|
||||||
|
srect = csbiInfo.srWindow;
|
||||||
|
srect.Right = srect.Left + 99;
|
||||||
|
srect.Bottom = srect.Top + 64;
|
||||||
|
SetConsoleWindowInfo(GetStdHandle(STD_OUTPUT_HANDLE), TRUE, &srect);
|
||||||
|
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CloseConsole() {
|
||||||
|
if (hConsole == NULL) return;
|
||||||
|
FreeConsole();
|
||||||
|
hConsole = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void printlog(char *fmt, ...) {
|
||||||
|
va_list list;
|
||||||
|
char msg[512],msg2[522];
|
||||||
|
wchar_t msg3[522];
|
||||||
|
char *ptr;
|
||||||
|
DWORD tmp;
|
||||||
|
int len, s;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
LPWSTR ret;
|
||||||
|
|
||||||
|
va_start(list,fmt);
|
||||||
|
_vsnprintf(msg,511,fmt,list);
|
||||||
|
msg[511] = '\0';
|
||||||
|
va_end(list);
|
||||||
|
ptr=msg; len=strlen(msg);
|
||||||
|
WriteConsole(hConsole,ptr, (DWORD)len, &tmp, 0);
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -20,6 +20,7 @@
|
||||||
#ifndef DEBUG_H
|
#ifndef DEBUG_H
|
||||||
#define DEBUG_H
|
#define DEBUG_H
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -50,6 +51,18 @@ extern Debug * MainLog;
|
||||||
void LogStart(void);
|
void LogStart(void);
|
||||||
void LogStop(void);
|
void LogStop(void);
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#ifdef BETA_VERSION
|
||||||
|
extern void OpenConsole();
|
||||||
|
extern void CloseConsole();
|
||||||
|
extern void printlog(LPCTSTR *fmt, ...);
|
||||||
|
#else
|
||||||
|
#define OpenConsole()
|
||||||
|
#define CloseConsole()
|
||||||
|
#define printlog(...)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define LOG(...) DebugPrintf(MainLog, __FILE__, __LINE__, __VA_ARGS__)
|
#define LOG(...) DebugPrintf(MainLog, __FILE__, __LINE__, __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -532,6 +532,7 @@ void NDS_Pause()
|
||||||
execute = FALSE;
|
execute = FALSE;
|
||||||
SPU_Pause(1);
|
SPU_Pause(1);
|
||||||
while (!paused) {}
|
while (!paused) {}
|
||||||
|
printlog("Paused\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDS_UnPause()
|
void NDS_UnPause()
|
||||||
|
@ -539,6 +540,7 @@ void NDS_UnPause()
|
||||||
paused = FALSE;
|
paused = FALSE;
|
||||||
execute = TRUE;
|
execute = TRUE;
|
||||||
SPU_Pause(0);
|
SPU_Pause(0);
|
||||||
|
printlog("Unpaused\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void StateSaveSlot(int num)
|
void StateSaveSlot(int num)
|
||||||
|
@ -546,6 +548,7 @@ void StateSaveSlot(int num)
|
||||||
NDS_Pause();
|
NDS_Pause();
|
||||||
savestate_slot(num);
|
savestate_slot(num);
|
||||||
NDS_UnPause();
|
NDS_UnPause();
|
||||||
|
printlog("Saved %i state\n",num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StateLoadSlot(int num)
|
void StateLoadSlot(int num)
|
||||||
|
@ -553,11 +556,13 @@ void StateLoadSlot(int num)
|
||||||
NDS_Pause();
|
NDS_Pause();
|
||||||
loadstate_slot(num);
|
loadstate_slot(num);
|
||||||
NDS_UnPause();
|
NDS_UnPause();
|
||||||
|
printlog("Loaded %i state\n",num);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LoadROM(char * filename, const char *cflash_disk_image)
|
BOOL LoadROM(char * filename, const char *cflash_disk_image)
|
||||||
{
|
{
|
||||||
NDS_Pause();
|
NDS_Pause();
|
||||||
|
if (strcmp(filename,"")!=0) printlog("Loading ROM: %s\n",filename);
|
||||||
|
|
||||||
if (NDS_LoadROM(filename, backupmemorytype, backupmemorysize, cflash_disk_image) > 0)
|
if (NDS_LoadROM(filename, backupmemorytype, backupmemorysize, cflash_disk_image) > 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -654,7 +659,6 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
struct armcpu_ctrl_iface *arm9_ctrl_iface;
|
struct armcpu_ctrl_iface *arm9_ctrl_iface;
|
||||||
struct armcpu_ctrl_iface *arm7_ctrl_iface;
|
struct armcpu_ctrl_iface *arm7_ctrl_iface;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct configured_features my_config;
|
struct configured_features my_config;
|
||||||
|
|
||||||
|
|
||||||
|
@ -666,6 +670,9 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
|
|
||||||
InitCustomControls();
|
InitCustomControls();
|
||||||
|
|
||||||
|
OpenConsole(); // Init debug console
|
||||||
|
printlog("DeSmuME v%s starting...\n\n",VERSION);
|
||||||
|
|
||||||
/* default the firmware settings, they may get changed later */
|
/* default the firmware settings, they may get changed later */
|
||||||
NDS_FillDefaultFirmwareConfigData( &win_fw_config);
|
NDS_FillDefaultFirmwareConfigData( &win_fw_config);
|
||||||
|
|
||||||
|
@ -711,7 +718,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
InitDesViewBox();
|
InitDesViewBox();
|
||||||
InitTileViewBox();
|
InitTileViewBox();
|
||||||
InitOAMViewBox();
|
InitOAMViewBox();
|
||||||
|
printlog("Init NDS\n");
|
||||||
#ifdef GDB_STUB
|
#ifdef GDB_STUB
|
||||||
if ( my_config.arm9_gdb_port != 0) {
|
if ( my_config.arm9_gdb_port != 0) {
|
||||||
arm9_gdb_stub = createStub_gdb( my_config.arm9_gdb_port,
|
arm9_gdb_stub = createStub_gdb( my_config.arm9_gdb_port,
|
||||||
|
@ -773,7 +780,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
#ifdef BETA_VERSION
|
#ifdef BETA_VERSION
|
||||||
EnableMenuItem (menu, IDM_SUBMITBUGREPORT, MF_GRAYED);
|
EnableMenuItem (menu, IDM_SUBMITBUGREPORT, MF_GRAYED);
|
||||||
#endif
|
#endif
|
||||||
|
printlog("Init sound core\n");
|
||||||
sndcoretype = GetPrivateProfileInt("Sound","SoundCore", SNDCORE_DIRECTX, IniName);
|
sndcoretype = GetPrivateProfileInt("Sound","SoundCore", SNDCORE_DIRECTX, IniName);
|
||||||
sndbuffersize = GetPrivateProfileInt("Sound","SoundBufferSize", 735 * 4, IniName);
|
sndbuffersize = GetPrivateProfileInt("Sound","SoundBufferSize", 735 * 4, IniName);
|
||||||
|
|
||||||
|
@ -875,6 +882,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
LogStop();
|
LogStop();
|
||||||
#endif
|
#endif
|
||||||
|
CloseConsole();
|
||||||
/* The program return-value is 0 - The value that PostQuitMessage() gave */
|
/* The program return-value is 0 - The value that PostQuitMessage() gave */
|
||||||
return messages.wParam;
|
return messages.wParam;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue