Nrage: Update code to latest code base

This commit is contained in:
zilmar 2025-05-08 15:22:34 +09:30
parent abbd18d6b4
commit 7e0ae07c50
6 changed files with 20 additions and 16 deletions

View File

@ -346,6 +346,12 @@ bool LoadCart(LPGBCART Cart, LPCTSTR RomFileName, LPCTSTR RamFileName, LPCTSTR T
case 0x06: case 0x06:
Cart->iNumRomBanks = 128; Cart->iNumRomBanks = 128;
break; break;
case 0x07:
Cart->iNumRomBanks = 256;
break;
case 0x08:
Cart->iNumRomBanks = 512;
break;
case 0x52: case 0x52:
Cart->iNumRomBanks = 72; Cart->iNumRomBanks = 72;
break; break;
@ -889,7 +895,7 @@ bool WriteCartMBC3(LPGBCART Cart, WORD dwAddress, BYTE *Data)
{ {
if (Cart->bHasRam) if (Cart->bHasRam)
{ {
Cart->iCurrentRamBankNo = Data[0] & 0x03; Cart->iCurrentRamBankNo = Data[0] & 0x07;
DebugWriteA("Set RAM Bank: %02X\n", Cart->iCurrentRamBankNo); DebugWriteA("Set RAM Bank: %02X\n", Cart->iCurrentRamBankNo);
if (Cart->bHasTimer && (Data[0] >= 0x08 && Data[0] <= 0x0c)) if (Cart->bHasTimer && (Data[0] >= 0x08 && Data[0] <= 0x0c))
{ {

View File

@ -3524,7 +3524,7 @@ bool GetButtonText( const BUTTON& btnButton, LPTSTR Buffer )
DWORD ScanKeyboard( LPDEVICE lpDevice, LPDWORD lpdwCounter, LPBUTTON pButton ) DWORD ScanKeyboard( LPDEVICE lpDevice, LPDWORD lpdwCounter, LPBUTTON pButton )
{ {
HRESULT hr; HRESULT hr;
BYTE cKeys[256]; BYTE cKeys[256] = {0};
hr = lpDevice->didHandle->GetDeviceState( sizeof( cKeys ), (LPVOID)&cKeys ); hr = lpDevice->didHandle->GetDeviceState( sizeof( cKeys ), (LPVOID)&cKeys );
if ( FAILED(hr) ) if ( FAILED(hr) )
@ -3534,9 +3534,8 @@ DWORD ScanKeyboard( LPDEVICE lpDevice, LPDWORD lpdwCounter, LPBUTTON pButton )
} }
int iGotKey = FALSE; int iGotKey = FALSE;
int i = 0;
for( i = 0; i < ARRAYSIZE( cKeys ); ++i ) for( int i = 1; i < ARRAYSIZE( cKeys ); ++i )
{ {
if (( cKeys[i] & 0x80 ) ) if (( cKeys[i] & 0x80 ) )
{ {

View File

@ -1329,19 +1329,19 @@ bool InsertNoteFile( LPBYTE aMemPak, LPCTSTR pszFileName )
int len = lstrlenA( szLine ); int len = lstrlenA( szLine );
i = 16; i = 16;
while(( szLine[i] != '}' ) && (i < len)) while((i < len) && ( szLine[i] != '}' ))
i++; i++;
szLine[i] = '\0'; szLine[i] = '\0';
i += ReverseNotesA( &szLine[16], &pBlock[12] ); i += ReverseNotesA( &szLine[16], &pBlock[12] );
while(( szLine[i] != '{' ) && (i < len)) while((i < len) && ( szLine[i] != '{' ))
i++; i++;
if(i < len) if(i < len)
{ {
int start = i+1; int start = i+1;
while(( szLine[i] != '}' ) && (i < len)) while((i < len) && ( szLine[i] != '}' ))
i++; i++;
if(i < len) if(i < len)
{ {
@ -1350,7 +1350,7 @@ bool InsertNoteFile( LPBYTE aMemPak, LPCTSTR pszFileName )
} }
} }
while(( szLine[i] != '}' ) && (i < len)) while((i < len) && ( szLine[i] != '}' ))
i++; i++;
szLine[i] = '\0'; szLine[i] = '\0';

View File

@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define VERSION_REVISION 1 #define VERSION_REVISION 1
#define VERSION_BUILD 9999 #define VERSION_BUILD 9999
#define VERSION_PREFIX "Dev-" #define VERSION_PREFIX "Dev-"
#define VERSION_BUILD_YEAR 2025
#define GIT_REVISION "" #define GIT_REVISION ""
#define GIT_REVISION_SHORT "" #define GIT_REVISION_SHORT ""

View File

@ -105,10 +105,10 @@ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput )
// If it does, then get the VID/PID from var.bstrVal // If it does, then get the VID/PID from var.bstrVal
DWORD dwPid = 0, dwVid = 0; DWORD dwPid = 0, dwVid = 0;
WCHAR* strVid = wcsstr( var.bstrVal, L"VID_" ); WCHAR* strVid = wcsstr( var.bstrVal, L"VID_" );
if (strVid && wscanf(strVid, L"VID_%4X", &dwVid) != 1) if (strVid && swscanf(strVid, L"VID_%4X", &dwVid) != 1)
dwVid = 0; dwVid = 0;
WCHAR* strPid = wcsstr( var.bstrVal, L"PID_" ); WCHAR* strPid = wcsstr( var.bstrVal, L"PID_" );
if (strPid && wscanf(strPid, L"PID_%4X", &dwPid) != 1) if (strPid && swscanf(strPid, L"PID_%4X", &dwPid) != 1)
dwPid = 0; dwPid = 0;
// Compare the VID/PID to the DInput device // Compare the VID/PID to the DInput device
@ -388,8 +388,7 @@ TCHAR * GetN64ButtonNameFromButtonCode( int Button )
{ {
using namespace N64_BUTTONS; using namespace N64_BUTTONS;
TCHAR *btnName; static TCHAR btnName[10];
btnName = new TCHAR[10];
switch( Button ) switch( Button )
{ {
@ -444,10 +443,9 @@ TCHAR * GetN64ButtonArrayFromXAnalog( LPXCONTROLLER gController, int XThStickOrX
using namespace N64_BUTTONS; using namespace N64_BUTTONS;
if( !gController || !gController->bConfigured ) if( !gController || !gController->bConfigured )
return NULL; return _T("");
TCHAR *name; static TCHAR name[15];
name = new TCHAR[15];
switch( XThStickOrXDpad ) switch( XThStickOrXDpad )
{ {

View File

@ -61,7 +61,7 @@ number, ie. first XInput controller is first N64 player, etc.
#include <xinput.h> #include <xinput.h>
// Defines // Defines
#define N64_ANALOG_MAX 127 #define N64_ANALOG_MAX 88
#define XC_ANALOG_MAX 32767 #define XC_ANALOG_MAX 32767
#define BUTTON_ANALOG_VALUE 60 #define BUTTON_ANALOG_VALUE 60