mirror of
https://github.com/libretro/FBNeo.git
synced 2024-11-23 08:59:39 +00:00
some minor bug fixes
This commit is contained in:
parent
ea8798d08e
commit
b9521e35ad
@ -15,11 +15,11 @@ INT32 (__cdecl *bprintf)(INT32 nStatus, TCHAR* szFormat, ...) = BurnbprintfFille
|
||||
#endif
|
||||
#endif
|
||||
|
||||
INT32 nBurnVer = BURN_VERSION; // Version number of the library
|
||||
INT32 nBurnVer = BURN_VERSION; // Version number of the library
|
||||
|
||||
UINT32 nBurnDrvCount = 0; // Count of game drivers
|
||||
UINT32 nBurnDrvActive = ~0U; // Which game driver is selected
|
||||
INT32 nBurnDrvSubActive = -1; // Which sub-game driver is selected
|
||||
UINT32 nBurnDrvCount = 0; // Count of game drivers
|
||||
UINT32 nBurnDrvActive = ~0U; // Which game driver is selected
|
||||
INT32 nBurnDrvSubActive = -1; // Which sub-game driver is selected
|
||||
UINT32 nBurnDrvSelect[8] = { ~0U, ~0U, ~0U, ~0U, ~0U, ~0U, ~0U, ~0U }; // Which games are selected (i.e. loaded but not necessarily active)
|
||||
|
||||
char* pszCustomNameA = NULL;
|
||||
@ -28,7 +28,7 @@ TCHAR szBackupNameW[MAX_PATH];
|
||||
|
||||
char** szShortNamesExArray = NULL;
|
||||
TCHAR** szLongNamesExArray = NULL;
|
||||
UINT32 nNamesExArray = 0;
|
||||
UINT32 nNamesExArray = 0;
|
||||
|
||||
bool bBurnUseMMX;
|
||||
#if defined BUILD_A68K
|
||||
@ -52,31 +52,31 @@ bool bBurnUseASMCPUEmulation = false;
|
||||
clock_t starttime = 0;
|
||||
#endif
|
||||
|
||||
UINT32 nCurrentFrame; // Framecount for emulated game
|
||||
UINT32 nCurrentFrame; // Framecount for emulated game
|
||||
|
||||
UINT32 nFramesEmulated; // Counters for FPS display
|
||||
UINT32 nFramesRendered; //
|
||||
bool bForce60Hz = false;
|
||||
bool bSpeedLimit60hz = true;
|
||||
double dForcedFrameRate = 60.00;
|
||||
bool bBurnUseBlend = true;
|
||||
INT32 nBurnFPS = 6000;
|
||||
UINT32 nFramesEmulated; // Counters for FPS display
|
||||
UINT32 nFramesRendered;
|
||||
bool bForce60Hz = false;
|
||||
bool bSpeedLimit60hz = true;
|
||||
double dForcedFrameRate = 60.00;
|
||||
bool bBurnUseBlend = true;
|
||||
INT32 nBurnFPS = 6000;
|
||||
INT32 nBurnCPUSpeedAdjust = 0x0100; // CPU speed adjustment (clock * nBurnCPUSpeedAdjust / 0x0100)
|
||||
|
||||
// Burn Draw:
|
||||
UINT8* pBurnDraw = NULL; // Pointer to correctly sized bitmap
|
||||
INT32 nBurnPitch = 0; // Pitch between each line
|
||||
UINT8* pBurnDraw = NULL; // Pointer to correctly sized bitmap
|
||||
INT32 nBurnPitch = 0; // Pitch between each line
|
||||
INT32 nBurnBpp; // Bytes per pixel (2, 3, or 4)
|
||||
|
||||
INT32 nBurnSoundRate = 0; // sample rate of sound or zero for no sound
|
||||
INT32 nBurnSoundLen = 0; // length in samples per frame
|
||||
INT32 nBurnSoundRate = 0; // sample rate of sound or zero for no sound
|
||||
INT32 nBurnSoundLen = 0; // length in samples per frame
|
||||
INT16* pBurnSoundOut = NULL; // pointer to output buffer
|
||||
|
||||
INT32 nInterpolation = 1; // Desired interpolation level for ADPCM/PCM sound
|
||||
INT32 nInterpolation = 1; // Desired interpolation level for ADPCM/PCM sound
|
||||
INT32 nFMInterpolation = 0; // Desired interpolation level for FM sound
|
||||
|
||||
UINT8 nBurnLayer = 0xFF; // Can be used externally to select which layers to show
|
||||
UINT8 nSpriteEnable = 0xFF; // Can be used externally to select which layers to show
|
||||
UINT8 nBurnLayer = 0xFF; // Can be used externally to select which layers to show
|
||||
UINT8 nSpriteEnable = 0xFF; // Can be used externally to select which layers to show
|
||||
|
||||
INT32 bRunAhead = 0;
|
||||
|
||||
@ -86,8 +86,8 @@ bool bSaveCRoms = 0;
|
||||
|
||||
UINT32 *pBurnDrvPalette;
|
||||
|
||||
static char** pszShortName = NULL;
|
||||
static wchar_t** pszFullName = NULL;
|
||||
static char** pszShortName = NULL, ** pszFullNameA = NULL;
|
||||
static wchar_t** pszFullNameW = NULL;
|
||||
|
||||
bool BurnCheckMMXSupport()
|
||||
{
|
||||
@ -102,37 +102,63 @@ bool BurnCheckMMXSupport()
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" INT32 BurnLibInit()
|
||||
{
|
||||
BurnLibExit();
|
||||
nBurnDrvCount = sizeof(pDriver) / sizeof(pDriver[0]); // count available drivers
|
||||
static void BurnGameListInit()
|
||||
{ // Avoid broken references, RomData requires separate string storage
|
||||
if (0 == nBurnDrvCount) return;
|
||||
|
||||
pszShortName = (char** )malloc(nBurnDrvCount * sizeof(char*));
|
||||
pszFullNameA = (char** )malloc(nBurnDrvCount * sizeof(char*));
|
||||
pszFullNameW = (wchar_t**)malloc(nBurnDrvCount * sizeof(wchar_t*));
|
||||
|
||||
// Avoid broken references, rom data requires separate string storage
|
||||
if (nBurnDrvCount > 0) {
|
||||
pszShortName = (char**)malloc(nBurnDrvCount * sizeof(char*));
|
||||
pszFullName = (wchar_t**)malloc(nBurnDrvCount * sizeof(wchar_t*));
|
||||
|
||||
if ((NULL != pszShortName) && (NULL != pszFullName)) {
|
||||
if ((NULL != pszShortName) && (NULL != pszFullNameA) && (NULL != pszFullNameW)) {
|
||||
for (UINT32 i = 0; i < nBurnDrvCount; i++) {
|
||||
pszShortName[i] = (char*)malloc(100 * sizeof(char));
|
||||
pszFullName[i] = (wchar_t*)malloc(MAX_PATH * sizeof(wchar_t));
|
||||
pszShortName[i] = (char* )malloc(100 * sizeof(char));
|
||||
pszFullNameA[i] = (char* )malloc(MAX_PATH * sizeof(char));
|
||||
pszFullNameW[i] = (wchar_t*)malloc(MAX_PATH * sizeof(wchar_t));
|
||||
|
||||
memset(pszShortName[i], '\0', 100 * sizeof(char));
|
||||
memset(pszFullName[i], '\0', MAX_PATH * sizeof(wchar_t));
|
||||
memset(pszShortName[i], '\0', 100 * sizeof(char));
|
||||
memset(pszFullNameA[i], '\0', MAX_PATH * sizeof(char));
|
||||
memset(pszFullNameW[i], '\0', MAX_PATH * sizeof(wchar_t));
|
||||
|
||||
if (NULL != pszShortName[i]) {
|
||||
strcpy(pszShortName[i], pDriver[i]->szShortName);
|
||||
pDriver[i]->szShortName = pszShortName[i];
|
||||
}
|
||||
if (NULL != pszFullNameA[i]) {
|
||||
strcpy(pszFullNameA[i], pDriver[i]->szFullNameA);
|
||||
pDriver[i]->szFullNameA = pszFullNameA[i];
|
||||
}
|
||||
#if defined (_UNICODE)
|
||||
if (NULL != pDriver[i]->szFullNameW) {
|
||||
wmemcpy(pszFullName[i], pDriver[i]->szFullNameW, MAX_PATH); // Include '\0'
|
||||
wmemcpy(pszFullNameW[i], pDriver[i]->szFullNameW, MAX_PATH); // Include '\0'
|
||||
}
|
||||
pDriver[i]->szFullNameW = pszFullName[i];
|
||||
pDriver[i]->szFullNameW = pszFullNameW[i];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void BurnGameListExit()
|
||||
{
|
||||
// Release of storage space
|
||||
for (UINT32 i = 0; i < nBurnDrvCount; i++) {
|
||||
if ((NULL != pszShortName) && (NULL != pszShortName[i])) free(pszShortName[i]);
|
||||
if ((NULL != pszFullNameA) && (NULL != pszFullNameA[i])) free(pszFullNameA[i]);
|
||||
if ((NULL != pszFullNameW) && (NULL != pszFullNameW[i])) free(pszFullNameW[i]);
|
||||
}
|
||||
if (NULL != pszShortName) free(pszShortName);
|
||||
if (NULL != pszFullNameA) free(pszFullNameA);
|
||||
if (NULL != pszFullNameW) free(pszFullNameW);
|
||||
}
|
||||
|
||||
extern "C" INT32 BurnLibInit()
|
||||
{
|
||||
BurnLibExit();
|
||||
|
||||
nBurnDrvCount = sizeof(pDriver) / sizeof(pDriver[0]); // count available drivers
|
||||
|
||||
BurnGameListInit();
|
||||
|
||||
BurnSoundInit();
|
||||
|
||||
@ -143,23 +169,7 @@ extern "C" INT32 BurnLibInit()
|
||||
|
||||
extern "C" INT32 BurnLibExit()
|
||||
{
|
||||
// Release of storage space
|
||||
if (NULL != pszShortName) {
|
||||
for (UINT32 i = 0; i < nBurnDrvCount; i++) {
|
||||
if (NULL != pszShortName[i]) {
|
||||
free(pszShortName[i]);
|
||||
}
|
||||
}
|
||||
free(pszShortName);
|
||||
}
|
||||
if (NULL != pszFullName) {
|
||||
for (UINT32 i = 0; i < nBurnDrvCount; i++) {
|
||||
if (NULL != pszFullName[i]) {
|
||||
free(pszFullName[i]);
|
||||
}
|
||||
}
|
||||
free(pszFullName);
|
||||
}
|
||||
BurnGameListExit();
|
||||
|
||||
nBurnDrvCount = 0;
|
||||
|
||||
@ -490,21 +500,27 @@ extern "C" char* BurnDrvGetTextA(UINT32 i)
|
||||
}
|
||||
}
|
||||
|
||||
static void BurnDrvSetFullNameA(char* szName)
|
||||
static INT32 BurnDrvSetFullNameA(char* szName, UINT32 i = nBurnDrvActive)
|
||||
{
|
||||
// Preventing the emergence of ~0U
|
||||
// If not NULL, then FullNameA is customized
|
||||
if (NULL == szName) return;
|
||||
if ((i >= 0) && (NULL != szName)) {
|
||||
memset(pszFullNameA[i], '\0', MAX_PATH * sizeof(char));
|
||||
strcpy(pszFullNameA[i], szName);
|
||||
|
||||
pDriver[nBurnDrvActive]->szFullNameA = szName;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
INT32 BurnDrvSetFullNameW(TCHAR* szName, INT32 i)
|
||||
INT32 BurnDrvSetFullNameW(TCHAR* szName, INT32 i = nBurnDrvActive)
|
||||
{
|
||||
if ((-1 == i) || (NULL == szName)) return -1;
|
||||
|
||||
#if defined (_UNICODE)
|
||||
memset(pszFullName[i], _T('\0'), MAX_PATH * sizeof(TCHAR));
|
||||
wcscpy(pszFullName[i], szName);
|
||||
memset(pszFullNameW[i], '\0', MAX_PATH * sizeof(wchar_t));
|
||||
wcscpy(pszFullNameW[i], szName);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
@ -517,8 +533,8 @@ void BurnLocalisationSetName(char* szName, TCHAR* szLongName)
|
||||
nBurnDrvActive = i;
|
||||
if (!strcmp(szName, pDriver[i]->szShortName)) {
|
||||
// pDriver[i]->szFullNameW = szLongName;
|
||||
memset(pszFullName[i], _T('\0'), MAX_PATH * sizeof(TCHAR));
|
||||
_tcscpy(pszFullName[i], szLongName);
|
||||
memset(pszFullNameW[i], '\0', MAX_PATH * sizeof(wchar_t));
|
||||
_tcscpy(pszFullNameW[i], szLongName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -547,7 +563,7 @@ static void BurnLocalisationSetNameEx()
|
||||
|
||||
for (INT32 nIndex = 0; nIndex < nNamesExArray; nIndex++) {
|
||||
if (0 == strcmp(szShortNamesExArray[nIndex], szShortNames)) {
|
||||
BurnDrvSetFullNameW(szLongNamesExArray[nIndex], nBurnDrvActive);
|
||||
BurnDrvSetFullNameW(szLongNamesExArray[nIndex]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -908,7 +924,7 @@ extern "C" INT32 BurnDrvExit()
|
||||
const wchar_t* _str1 = L"", * _str2 = BurnDrvGetFullNameW(nBurnDrvActive);
|
||||
|
||||
if (0 != _tcscmp(_str1, _str2)) {
|
||||
BurnDrvSetFullNameW(szBackupNameW, nBurnDrvActive);
|
||||
BurnDrvSetFullNameW(szBackupNameW);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ void BurnerExitGameListLocalisation();
|
||||
int FBALocaliseGamelistLoadTemplate();
|
||||
int FBALocaliseGamelistCreateTemplate();
|
||||
|
||||
INT32 BurnDrvSetFullNameW(TCHAR* szName, INT32 i);
|
||||
INT32 BurnDrvSetFullNameW(TCHAR* szName, INT32 i = nBurnDrvActive);
|
||||
|
||||
// popup_win32.cpp
|
||||
enum FBAPopupType { MT_NONE = 0, MT_ERROR, MT_WARNING, MT_INFO };
|
||||
|
@ -274,17 +274,17 @@ static void FillListBox()
|
||||
TCHAR Temp[256];
|
||||
TVITEM Tvi;
|
||||
memset(&Tvi, 0, sizeof(Tvi));
|
||||
Tvi.hItem = hItemHandles[i];
|
||||
Tvi.mask = TVIF_TEXT | TVIF_HANDLE;
|
||||
Tvi.pszText = Temp;
|
||||
Tvi.hItem = hItemHandles[i];
|
||||
Tvi.mask = TVIF_TEXT | TVIF_HANDLE;
|
||||
Tvi.pszText = Temp;
|
||||
Tvi.cchTextMax = 256;
|
||||
SendMessage(hIpsList, TVM_GETITEM, (WPARAM)0, (LPARAM)&Tvi);
|
||||
|
||||
if (!_tcsicmp(Tvi.pszText, szCategory)) hNode = Tvi.hItem;
|
||||
}
|
||||
|
||||
TvItem.hParent = hNode;
|
||||
TvItem.item.pszText = Tokens;
|
||||
TvItem.hParent = hNode;
|
||||
TvItem.item.pszText = Tokens;
|
||||
hItemHandles[nHandlePos] = (HTREEITEM)SendMessage(hIpsList, TVM_INSERTITEM, 0, (LPARAM)&TvItem);
|
||||
|
||||
hPatchHandlesIndex[nPatchIndex] = hItemHandles[nHandlePos];
|
||||
@ -907,7 +907,6 @@ static void DoPatchGame(const char* patch_name, char* game_name, UINT32 crc, UIN
|
||||
char* ips_crc = NULL;
|
||||
UINT32 nIps_crc = 0;
|
||||
FILE* fp = NULL;
|
||||
unsigned long nIpsSize;
|
||||
|
||||
//bprintf(0, _T("DoPatchGame [%S][%S]\n"), patch_name, game_name);
|
||||
|
||||
@ -1006,7 +1005,7 @@ static void DoPatchGame(const char* patch_name, char* game_name, UINT32 crc, UIN
|
||||
|
||||
static UINT32 GetIpsDefineExpValue(char* szTmp)
|
||||
{
|
||||
if (NULL == (szTmp = strtok(NULL, " \t\r\n")))
|
||||
if (NULL == (szTmp = strqtoken(NULL, " \t\r\n")))
|
||||
return 0U;
|
||||
|
||||
INT32 nRet = 0;
|
||||
@ -1070,11 +1069,11 @@ static void GetIpsDrvDefine()
|
||||
if (0 == strncmp(ptr, UTF8_SIGNATURE, strlen(UTF8_SIGNATURE)))
|
||||
ptr += strlen(UTF8_SIGNATURE);
|
||||
|
||||
if (NULL == (tmp = strtok(ptr, " \t\r\n")))
|
||||
if (NULL == (tmp = strqtoken(ptr, " \t\r\n")))
|
||||
continue;
|
||||
if (0 != strcmp(tmp, "#define"))
|
||||
break;
|
||||
if (NULL == (tmp = strtok(NULL, " \t\r\n")))
|
||||
if (NULL == (tmp = strqtoken(NULL, " \t\r\n")))
|
||||
break;
|
||||
|
||||
UINT32 nNewValue = 0;
|
||||
|
@ -74,14 +74,14 @@ static void BurnerDoGameListExLocalisation()
|
||||
rewind(gl);
|
||||
memset(szTemp, 0, sizeof(szTemp));
|
||||
|
||||
szShortNamesExArray = (char**)malloc(nNamesExArray * sizeof(char*));
|
||||
szShortNamesExArray = (char** )malloc(nNamesExArray * sizeof(char*));
|
||||
szLongNamesExArray = (TCHAR**)malloc(nNamesExArray * sizeof(TCHAR*));
|
||||
|
||||
if ((NULL != szShortNamesExArray) && (NULL != szLongNamesExArray)) {
|
||||
// Allocate arrays to read the file into
|
||||
for (INT32 i = 0; i < nNamesExArray; i++) {
|
||||
szShortNamesExArray[i] = (char*)malloc(100);
|
||||
szLongNamesExArray[i] = (TCHAR*)malloc(MAX_LST_LINE_LEN * sizeof(TCHAR));
|
||||
szShortNamesExArray[i] = (char* )malloc(100);
|
||||
szLongNamesExArray[i] = (TCHAR*)malloc(MAX_LST_LINE_LEN * sizeof(TCHAR));
|
||||
memset(szShortNamesExArray[i], '\0', 100);
|
||||
memset(szLongNamesExArray[i], _T('\0'), MAX_LST_LINE_LEN * sizeof(TCHAR));
|
||||
}
|
||||
@ -142,10 +142,10 @@ void BurnerDoGameListLocalisation()
|
||||
|
||||
// Allocate arrays to read the file into
|
||||
for (int i = 0; i < MAX_LST_GAMES; i++) {
|
||||
szLongNamesArray[i] = (TCHAR*)malloc(MAX_LST_LINE_LEN * sizeof(TCHAR));
|
||||
szShortNamesArray[i] = (TCHAR*)malloc(100 * sizeof(TCHAR));
|
||||
memset(szLongNamesArray[i], _T('\0'), MAX_LST_LINE_LEN * sizeof(TCHAR));
|
||||
memset(szShortNamesArray[i], _T('\0'), 100 * sizeof(TCHAR));
|
||||
szLongNamesArray[i] = (TCHAR*)malloc( MAX_LST_LINE_LEN * sizeof(TCHAR));
|
||||
szShortNamesArray[i] = (TCHAR*)malloc( 100 * sizeof(TCHAR));
|
||||
memset(szLongNamesArray[i], _T('\0'), MAX_LST_LINE_LEN * sizeof(TCHAR));
|
||||
memset(szShortNamesArray[i], _T('\0'), 100 * sizeof(TCHAR));
|
||||
}
|
||||
|
||||
char szTemp[MAX_LST_LINE_LEN];
|
||||
@ -157,13 +157,13 @@ void BurnerDoGameListLocalisation()
|
||||
|
||||
if (!strncmp(szTemp, "codepage=", 9)) {
|
||||
if ((strlen(szTemp) - 10) == 4) {
|
||||
nCodePage = (szTemp[9] - '0') * 1000;
|
||||
nCodePage = (szTemp[ 9] - '0') * 1000;
|
||||
nCodePage += (szTemp[10] - '0') * 100;
|
||||
nCodePage += (szTemp[11] - '0') * 10;
|
||||
nCodePage += (szTemp[12] - '0');
|
||||
}
|
||||
if ((strlen(szTemp) - 10) == 3) {
|
||||
nCodePage = (szTemp[9] - '0') * 100;
|
||||
nCodePage = (szTemp[ 9] - '0') * 100;
|
||||
nCodePage += (szTemp[10] - '0') * 10;
|
||||
nCodePage += (szTemp[11] - '0');
|
||||
}
|
||||
@ -250,8 +250,8 @@ void BurnerExitGameListLocalisation()
|
||||
}
|
||||
if (i < nNamesExArray) {
|
||||
if (NULL != szShortNamesExArray[i]) {
|
||||
free(szLongNamesExArray[i]);
|
||||
szLongNamesExArray[i] = NULL;
|
||||
free(szShortNamesExArray[i]);
|
||||
szShortNamesExArray[i] = NULL;
|
||||
}
|
||||
if (NULL != szLongNamesExArray[i]) {
|
||||
free(szLongNamesExArray[i]);
|
||||
@ -260,8 +260,8 @@ void BurnerExitGameListLocalisation()
|
||||
}
|
||||
}
|
||||
if (NULL != szShortNamesExArray) {
|
||||
free(szLongNamesExArray);
|
||||
szLongNamesExArray = NULL;
|
||||
free(szShortNamesExArray);
|
||||
szShortNamesExArray = NULL;
|
||||
}
|
||||
if (NULL != szLongNamesExArray) {
|
||||
free(szLongNamesExArray);
|
||||
|
Loading…
Reference in New Issue
Block a user