-Fixed a few things that didn't make sense
This commit is contained in:
parent
2f9339df37
commit
b20ea3a201
|
@ -43,11 +43,7 @@
|
||||||
#include "../cflash.h"
|
#include "../cflash.h"
|
||||||
#include "ConfigKeys.h"
|
#include "ConfigKeys.h"
|
||||||
|
|
||||||
#ifdef USE_SDL_AUDIO
|
|
||||||
#include "../sndsdl.h"
|
|
||||||
#else
|
|
||||||
#include "snddx.h"
|
#include "snddx.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RENDER3D
|
#ifdef RENDER3D
|
||||||
#include "OGLRender.h"
|
#include "OGLRender.h"
|
||||||
|
@ -84,11 +80,7 @@ DWORD ds_up,ds_down,ds_left,ds_right,ds_a,ds_b,ds_x,ds_y,ds_l,ds_r,ds_select,ds_
|
||||||
SoundInterface_struct *SNDCoreList[] = {
|
SoundInterface_struct *SNDCoreList[] = {
|
||||||
&SNDDummy,
|
&SNDDummy,
|
||||||
&SNDFile,
|
&SNDFile,
|
||||||
#ifdef USE_SDL_AUDIO
|
|
||||||
&SNDSDL,
|
|
||||||
#else
|
|
||||||
&SNDDIRECTX,
|
&SNDDIRECTX,
|
||||||
#endif
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -133,7 +125,6 @@ DWORD WINAPI run( LPVOID lpParameter)
|
||||||
{
|
{
|
||||||
while(execute)
|
while(execute)
|
||||||
{
|
{
|
||||||
SPU_Pause(0);
|
|
||||||
cycles = NDS_exec((560190<<1)-cycles,FALSE);
|
cycles = NDS_exec((560190<<1)-cycles,FALSE);
|
||||||
SPU_Emulate();
|
SPU_Emulate();
|
||||||
|
|
||||||
|
@ -203,18 +194,28 @@ DWORD WINAPI run( LPVOID lpParameter)
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow_RefreshALL();
|
CWindow_RefreshALL();
|
||||||
//Sleep(0);
|
Sleep(0);
|
||||||
//execute = FALSE;
|
|
||||||
}
|
}
|
||||||
SPU_Pause(1);
|
|
||||||
Sleep(500);
|
Sleep(500);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NDS_Pause()
|
||||||
|
{
|
||||||
|
execute = FALSE;
|
||||||
|
SPU_Pause(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NDS_UnPause()
|
||||||
|
{
|
||||||
|
execute = TRUE;
|
||||||
|
SPU_Pause(0);
|
||||||
|
}
|
||||||
|
|
||||||
BOOL LoadROM(char * filename)
|
BOOL LoadROM(char * filename)
|
||||||
{
|
{
|
||||||
execute = FALSE;
|
NDS_Pause();
|
||||||
|
|
||||||
if (NDS_LoadROM(filename) > 0)
|
if (NDS_LoadROM(filename) > 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -264,11 +265,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
|
|
||||||
NDS_Init();
|
NDS_Init();
|
||||||
|
|
||||||
#ifdef USE_SDL_AUDIO
|
|
||||||
if (SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4) != 0)
|
|
||||||
#else
|
|
||||||
if (SPU_ChangeSoundCore(SNDCORE_DIRECTX, 735 * 4) != 0)
|
if (SPU_ChangeSoundCore(SNDCORE_DIRECTX, 735 * 4) != 0)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
MessageBox(hwnd,"Unable to initialize DirectSound","Error",MB_OK);
|
MessageBox(hwnd,"Unable to initialize DirectSound","Error",MB_OK);
|
||||||
return messages.wParam;
|
return messages.wParam;
|
||||||
|
@ -280,7 +277,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
{
|
{
|
||||||
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
|
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
|
||||||
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
|
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
|
||||||
execute = TRUE;
|
NDS_UnPause();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -311,7 +308,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
ReadConfig();
|
ReadConfig();
|
||||||
return 0;
|
return 0;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
execute = FALSE;
|
NDS_Pause();
|
||||||
|
|
||||||
if (runthread != INVALID_HANDLE_VALUE)
|
if (runthread != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -329,7 +326,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
PostQuitMessage (0); // send a WM_QUIT to the message queue
|
PostQuitMessage (0); // send a WM_QUIT to the message queue
|
||||||
return 0;
|
return 0;
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
execute = FALSE;
|
NDS_Pause();
|
||||||
|
|
||||||
if (runthread != INVALID_HANDLE_VALUE)
|
if (runthread != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -354,7 +351,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
{
|
{
|
||||||
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
|
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
|
||||||
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
|
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
|
||||||
execute = TRUE;
|
NDS_UnPause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -516,7 +513,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
{
|
{
|
||||||
case IDM_OPEN:
|
case IDM_OPEN:
|
||||||
{
|
{
|
||||||
execute = FALSE; //Stop emulation while opening new rom
|
NDS_Pause(); //Stop emulation while opening new rom
|
||||||
|
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
char filename[MAX_PATH] = "";
|
char filename[MAX_PATH] = "";
|
||||||
|
@ -531,7 +528,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
|
|
||||||
if(!GetOpenFileName(&ofn))
|
if(!GetOpenFileName(&ofn))
|
||||||
{
|
{
|
||||||
execute = TRUE; //Restart emulation if no new rom chosen
|
NDS_UnPause(); //Restart emulation if no new rom chosen
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +553,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
{
|
{
|
||||||
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
|
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
|
||||||
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
|
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
|
||||||
execute = TRUE;
|
NDS_UnPause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -584,7 +581,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
return 0;
|
return 0;
|
||||||
case IDM_STATE_LOAD:
|
case IDM_STATE_LOAD:
|
||||||
{
|
{
|
||||||
execute = FALSE;
|
NDS_Pause();
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
//char nomFichier[MAX_PATH] = "";
|
//char nomFichier[MAX_PATH] = "";
|
||||||
ZeroMemory(&ofn, sizeof(ofn));
|
ZeroMemory(&ofn, sizeof(ofn));
|
||||||
|
@ -604,12 +601,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
//log::ajouter(SavName);
|
//log::ajouter(SavName);
|
||||||
|
|
||||||
savestate_load(SavName);
|
savestate_load(SavName);
|
||||||
execute = TRUE;
|
NDS_UnPause();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case IDM_STATE_SAVE:
|
case IDM_STATE_SAVE:
|
||||||
{
|
{
|
||||||
execute = FALSE;
|
NDS_Pause();
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
//char nomFichier[MAX_PATH] = "";
|
//char nomFichier[MAX_PATH] = "";
|
||||||
ZeroMemory(&ofn, sizeof(ofn));
|
ZeroMemory(&ofn, sizeof(ofn));
|
||||||
|
@ -637,7 +634,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
//strcpy(SavName, SavName + "dst");
|
//strcpy(SavName, SavName + "dst");
|
||||||
|
|
||||||
savestate_save(SavName);
|
savestate_save(SavName);
|
||||||
execute = TRUE;
|
NDS_UnPause();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case IDM_GAME_INFO:
|
case IDM_GAME_INFO:
|
||||||
|
@ -815,12 +812,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
case IDM_EXEC:
|
case IDM_EXEC:
|
||||||
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
|
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
|
||||||
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
|
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
|
||||||
execute = TRUE;
|
NDS_UnPause();
|
||||||
return 0;
|
return 0;
|
||||||
case IDM_PAUSE:
|
case IDM_PAUSE:
|
||||||
EnableMenuItem(menu, IDM_EXEC, MF_ENABLED);
|
EnableMenuItem(menu, IDM_EXEC, MF_ENABLED);
|
||||||
EnableMenuItem(menu, IDM_PAUSE, MF_GRAYED);
|
EnableMenuItem(menu, IDM_PAUSE, MF_GRAYED);
|
||||||
execute = FALSE;
|
NDS_Pause();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#define saver(one,two,three,four,five) \
|
#define saver(one,two,three,four,five) \
|
||||||
|
|
Loading…
Reference in New Issue