1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

(R): Remove RSPTHREAD code.

This commit is contained in:
Sergey Lipskiy 2013-11-29 12:15:58 +07:00
parent ef50ef71d2
commit cbaece1021
6 changed files with 1 additions and 266 deletions

View File

@ -1,5 +1,6 @@
#include <assert.h>
#include <stdio.h>
#include "convert.h"
#include "GLideN64.h"
#include "GBI.h"
#include "RDP.h"

View File

@ -49,9 +49,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
if (dwReason == DLL_PROCESS_ATTACH)
{
Config_LoadConfig();
#ifdef RSPTHREAD
RSP.thread = NULL;
#endif
OGL.hRC = NULL;
OGL.hDC = NULL;
/* OGL.hPbufferRC = NULL;
@ -67,24 +64,13 @@ _init( void )
{
Config_LoadConfig();
OGL.hScreen = NULL;
# ifdef RSPTHREAD
RSP.thread = NULL;
# endif
}
#endif // !__LINUX__
EXPORT void CALL CaptureScreen ( char * Directory )
{
screenDirectory = Directory;
#ifdef RSPTHREAD
if (RSP.thread)
{
SetEvent( RSP.threadMsg[RSPMSG_CAPTURESCREEN] );
WaitForSingleObject( RSP.threadFinished, INFINITE );
}
#else
OGL.captureScreen = true;
#endif
}
EXPORT void CALL CloseDLL (void)
@ -224,76 +210,9 @@ extern "C" {
EXPORT void CALL ChangeWindow (void)
{
#ifdef RSPTHREAD
// Textures seem to get corrupted when changing video modes (at least on my Radeon), so destroy them
SetEvent( RSP.threadMsg[RSPMSG_DESTROYTEXTURES] );
WaitForSingleObject( RSP.threadFinished, INFINITE );
if (!OGL.fullscreen)
{
DEVMODE fullscreenMode;
memset( &fullscreenMode, 0, sizeof(DEVMODE) );
fullscreenMode.dmSize = sizeof(DEVMODE);
fullscreenMode.dmPelsWidth = OGL.fullscreenWidth;
fullscreenMode.dmPelsHeight = OGL.fullscreenHeight;
fullscreenMode.dmBitsPerPel = OGL.fullscreenBits;
fullscreenMode.dmDisplayFrequency = OGL.fullscreenRefresh;
fullscreenMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
if (ChangeDisplaySettings( &fullscreenMode, CDS_FULLSCREEN ) != DISP_CHANGE_SUCCESSFUL)
{
MessageBox( NULL, "Failed to change display mode", pluginName, MB_ICONERROR | MB_OK );
return;
}
ShowCursor( FALSE );
windowedMenu = GetMenu( hWnd );
if (windowedMenu)
SetMenu( hWnd, NULL );
if (hStatusBar)
ShowWindow( hStatusBar, SW_HIDE );
windowedExStyle = GetWindowLong( hWnd, GWL_EXSTYLE );
windowedStyle = GetWindowLong( hWnd, GWL_STYLE );
SetWindowLong( hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST );
SetWindowLong( hWnd, GWL_STYLE, WS_POPUP );
GetWindowRect( hWnd, &windowedRect );
OGL.fullscreen = TRUE;
OGL_ResizeWindow();
}
else
{
ChangeDisplaySettings( NULL, 0 );
ShowCursor( TRUE );
if (windowedMenu)
SetMenu( hWnd, windowedMenu );
if (hStatusBar)
ShowWindow( hStatusBar, SW_SHOW );
SetWindowLong( hWnd, GWL_STYLE, windowedStyle );
SetWindowLong( hWnd, GWL_EXSTYLE, windowedExStyle );
SetWindowPos( hWnd, NULL, windowedRect.left, windowedRect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE );
OGL.fullscreen = FALSE;
OGL_ResizeWindow();
}
SetEvent( RSP.threadMsg[RSPMSG_INITTEXTURES] );
WaitForSingleObject( RSP.threadFinished, INFINITE );
#else // RSPTHREAD
# ifdef __LINUX__
SDL_WM_ToggleFullScreen( OGL.hScreen );
# endif // __LINUX__
#endif // !RSPTHREAD
}
EXPORT void CALL MoveScreen (int xpos, int ypos)
@ -343,9 +262,6 @@ EXPORT BOOL CALL InitiateGFX (GFX_INFO Gfx_Info)
#else // !__LINUX__
Config_LoadConfig();
OGL.hScreen = NULL;
# ifdef RSPTHREAD
RSP.thread = NULL;
# endif
#endif // __LINUX__
#else // MUPENPLUSAPI
Config_LoadConfig();
@ -358,73 +274,16 @@ EXPORT BOOL CALL InitiateGFX (GFX_INFO Gfx_Info)
EXPORT void CALL ProcessDList(void)
{
#ifdef RSPTHREAD
if (RSP.thread)
{
SetEvent( RSP.threadMsg[RSPMSG_PROCESSDLIST] );
WaitForSingleObject( RSP.threadFinished, INFINITE );
}
#else
RSP_ProcessDList();
#endif
}
EXPORT void CALL ProcessRDPList(void)
{
//*REG.DPC_CURRENT = *REG.DPC_START;
/* RSP.PCi = 0;
RSP.PC[RSP.PCi] = *REG.DPC_CURRENT;
RSP.halt = FALSE;
while (RSP.PC[RSP.PCi] < *REG.DPC_END)
{
RSP.cmd0 = *(DWORD*)&RDRAM[RSP.PC[RSP.PCi]];
RSP.cmd1 = *(DWORD*)&RDRAM[RSP.PC[RSP.PCi] + 4];
RSP.PC[RSP.PCi] += 8;
/* if ((RSP.cmd0 >> 24) == 0xE9)
{
*REG.MI_INTR |= MI_INTR_DP;
CheckInterrupts();
}
if ((RSP.cmd0 >> 24) == 0xCD)
RSP.cmd0 = RSP.cmd0;
GFXOp[RSP.cmd0 >> 24]();*/
//*REG.DPC_CURRENT += 8;
// }
}
EXPORT void CALL RomClosed (void)
{
#ifdef RSPTHREAD
int i;
if (RSP.thread)
{
// if (OGL.fullscreen)
// ChangeWindow();
if (RSP.busy)
{
RSP.halt = TRUE;
WaitForSingleObject( RSP.threadFinished, INFINITE );
}
SetEvent( RSP.threadMsg[RSPMSG_CLOSE] );
WaitForSingleObject( RSP.threadFinished, INFINITE );
for (i = 0; i < 4; i++)
if (RSP.threadMsg[i])
CloseHandle( RSP.threadMsg[i] );
CloseHandle( RSP.threadFinished );
CloseHandle( RSP.thread );
}
RSP.thread = NULL;
#else
OGL_Stop();
#endif
#ifdef DEBUG
CloseDebugDlg();
@ -433,37 +292,7 @@ EXPORT void CALL RomClosed (void)
EXPORT void CALL RomOpen (void)
{
#ifdef RSPTHREAD
# ifndef __LINUX__
DWORD threadID;
int i;
// Create RSP message events
for (i = 0; i < 6; i++)
{
RSP.threadMsg[i] = CreateEvent( NULL, FALSE, FALSE, NULL );
if (RSP.threadMsg[i] == NULL)
{
MessageBox( hWnd, "Error creating video thread message events, closing video thread...", "glN64 Error", MB_OK | MB_ICONERROR );
return;
}
}
// Create RSP finished event
RSP.threadFinished = CreateEvent( NULL, FALSE, FALSE, NULL );
if (RSP.threadFinished == NULL)
{
MessageBox( hWnd, "Error creating video thread finished event, closing video thread...", "glN64 Error", MB_OK | MB_ICONERROR );
return;
}
RSP.thread = CreateThread( NULL, 4096, RSP_ThreadProc, NULL, NULL, &threadID );
WaitForSingleObject( RSP.threadFinished, INFINITE );
# else // !__LINUX__
# endif // __LINUX__
#else
RSP_Init();
#endif
OGL_ResizeWindow();
@ -479,15 +308,7 @@ EXPORT void CALL ShowCFB (void)
EXPORT void CALL UpdateScreen (void)
{
#ifdef RSPTHREAD
if (RSP.thread)
{
SetEvent( RSP.threadMsg[RSPMSG_UPDATESCREEN] );
WaitForSingleObject( RSP.threadFinished, INFINITE );
}
#else
VI_UpdateScreen();
#endif
}
EXPORT void CALL ViStatusChanged (void)

View File

@ -17,7 +17,6 @@ extern HINSTANCE hInstance;
#endif
//#define DEBUG
//#define RSPTHREAD
extern void (*CheckInterrupts)( void );
extern char *screenDirectory;

59
RSP.cpp
View File

@ -128,65 +128,6 @@ LoadLoop:
#endif // __LINUX__
}
#ifdef RSPTHREAD
DWORD WINAPI RSP_ThreadProc( LPVOID lpParameter )
{
RSP_Init();
SetEvent( RSP.threadFinished );
#ifndef _DEBUG
__try
{
#endif
while (TRUE)
{
switch (WaitForMultipleObjects( 6, RSP.threadMsg, FALSE, INFINITE ))
{
case (WAIT_OBJECT_0 + RSPMSG_PROCESSDLIST):
RSP_ProcessDList();
break;
case (WAIT_OBJECT_0 + RSPMSG_UPDATESCREEN):
VI_UpdateScreen();
break;
case (WAIT_OBJECT_0 + RSPMSG_CLOSE):
OGL_Stop();
SetEvent( RSP.threadFinished );
return 1;
case (WAIT_OBJECT_0 + RSPMSG_DESTROYTEXTURES):
Combiner_Destroy();
FrameBuffer_Destroy();
TextureCache_Destroy();
break;
case (WAIT_OBJECT_0 + RSPMSG_INITTEXTURES):
FrameBuffer_Init();
TextureCache_Init();
Combiner_Init();
gSP.changed = gDP.changed = 0xFFFFFFFF;
break;
case (WAIT_OBJECT_0 + RSPMSG_CAPTURESCREEN):
OGL_SaveScreenshot();
break;
}
SetEvent( RSP.threadFinished );
}
#ifndef _DEBUG
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
char exception[256];
sprintf( exception, "Win32 exception 0x%08X occured in glN64", GetExceptionCode() );
MessageBox( NULL, exception, pluginName, MB_OK | MB_ICONERROR );
GBI_Destroy();
DepthBuffer_Destroy();
OGL_Stop();
}
#endif
RSP.thread = NULL;
return 0;
}
#endif // RSPTHREAD
void RSP_ProcessDList()
{
VI_UpdateSize();

23
RSP.h
View File

@ -13,28 +13,8 @@
#include "gSP.h"
#include "Types.h"
#define RSPMSG_CLOSE 0
#define RSPMSG_UPDATESCREEN 1
#define RSPMSG_PROCESSDLIST 2
#define RSPMSG_CAPTURESCREEN 3
#define RSPMSG_DESTROYTEXTURES 4
#define RSPMSG_INITTEXTURES 5
typedef struct
{
#ifdef RSPTHREAD
# ifndef __LINUX__
HANDLE thread;
// Events for thread messages, see defines at the top, or RSP_Thread
HANDLE threadMsg[6];
// Event to notify main process that the RSP is finished with what it was doing
HANDLE threadFinished;
# else
SDL_Thread *thread;
int threadMsg[6];
# endif // !__LINUX__
#endif // RSPTHREAD
u32 PC[18], PCi, busy, halt, close, DList, uc_start, uc_dstart, cmd, nextCmd, count;
} RSPInfo;
@ -44,9 +24,6 @@ extern RSPInfo RSP;
void RSP_Init();
void RSP_ProcessDList();
#ifdef RSPTHREAD
DWORD WINAPI RSP_ThreadProc( LPVOID lpParameter );
#endif
void RSP_LoadMatrix( f32 mtx[4][4], u32 address );
#endif

View File

@ -64,11 +64,7 @@ void gSPLoadUcodeEx( u32 uc_start, u32 uc_dstart, u16 uc_dsize )
if (ucode->type != NONE)
GBI_MakeCurrent( ucode );
else
#ifdef RSPTHREAD
SetEvent( RSP.threadMsg[RSPMSG_CLOSE] );
#else
puts( "Warning: Unknown UCODE!!!" );
#endif
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Unknown microcode: 0x%08X, 0x%08X, %s\n", uc_crc, uc_dcrc, uc_str );