SDL Fixes [dmitry_smagin]
This commit is contained in:
parent
954078d345
commit
ebc4f75a90
1412
makefile.sdl
1412
makefile.sdl
File diff suppressed because it is too large
Load Diff
|
@ -494,7 +494,7 @@ INT32 PNGLoad(IMAGE* img, FILE* fp, INT32 nPreset)
|
|||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
||||
} else {
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef BUILD_WIN32
|
||||
// Find resource
|
||||
HRSRC hrsrc = FindResource(NULL, MAKEINTRESOURCE(BMP_SPLASH), RT_BITMAP);
|
||||
HGLOBAL hglobal = LoadResource(NULL, (HRSRC)hrsrc);
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#include "SDL.h"
|
||||
#if defined __GNUC__
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned int DWORD;
|
||||
#endif
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
// defines to override various #ifndef _WIN32
|
||||
typedef struct tagRECT {
|
||||
int left;
|
||||
int top;
|
||||
|
@ -12,14 +8,16 @@ typedef struct tagRECT {
|
|||
int bottom;
|
||||
} RECT,*PRECT,*LPRECT;
|
||||
typedef const RECT *LPCRECT;
|
||||
#endif
|
||||
|
||||
typedef unsigned long DWORD;
|
||||
typedef unsigned char BYTE;
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 511
|
||||
#endif
|
||||
|
||||
#ifndef __cdecl
|
||||
#define __cdecl
|
||||
#define __cdecl
|
||||
#endif
|
||||
|
||||
//main.cpp
|
||||
|
@ -31,10 +29,8 @@ TCHAR* ANSIToTCHAR(const char* pszInString, TCHAR* pszOutString, int nOutSize);
|
|||
char* TCHARToANSI(const TCHAR* pszInString, char* pszOutString, int nOutSize);
|
||||
bool AppProcessKeyboardInput();
|
||||
|
||||
|
||||
|
||||
//config.cpp
|
||||
int ConfigAppLoad();
|
||||
int ConfigAppLoad();
|
||||
int ConfigAppSave();
|
||||
|
||||
// drv.cpp
|
||||
|
@ -53,7 +49,6 @@ extern int RunReset();
|
|||
//inpdipsw.cpp
|
||||
void InpDIPSWResetDIPs();
|
||||
|
||||
|
||||
//interface/inp_interface.cpp
|
||||
int InputInit();
|
||||
int InputExit();
|
||||
|
@ -62,6 +57,7 @@ int InputMake(bool bCopy);
|
|||
//TODO:
|
||||
#define szAppBurnVer 1
|
||||
|
||||
//stringset.cpp
|
||||
class StringSet {
|
||||
public:
|
||||
TCHAR* szText;
|
||||
|
@ -73,3 +69,24 @@ public:
|
|||
~StringSet();
|
||||
};
|
||||
|
||||
// support_paths.cpp
|
||||
extern TCHAR szAppPreviewsPath[MAX_PATH];
|
||||
extern TCHAR szAppTitlesPath[MAX_PATH];
|
||||
extern TCHAR szAppSelectPath[MAX_PATH];
|
||||
extern TCHAR szAppVersusPath[MAX_PATH];
|
||||
extern TCHAR szAppHowtoPath[MAX_PATH];
|
||||
extern TCHAR szAppScoresPath[MAX_PATH];
|
||||
extern TCHAR szAppBossesPath[MAX_PATH];
|
||||
extern TCHAR szAppGameoverPath[MAX_PATH];
|
||||
extern TCHAR szAppFlyersPath[MAX_PATH];
|
||||
extern TCHAR szAppMarqueesPath[MAX_PATH];
|
||||
extern TCHAR szAppControlsPath[MAX_PATH];
|
||||
extern TCHAR szAppCabinetsPath[MAX_PATH];
|
||||
extern TCHAR szAppPCBsPath[MAX_PATH];
|
||||
extern TCHAR szAppCheatsPath[MAX_PATH];
|
||||
extern TCHAR szAppHistoryPath[MAX_PATH];
|
||||
extern TCHAR szAppListsPath[MAX_PATH];
|
||||
extern TCHAR szAppDatListsPath[MAX_PATH];
|
||||
extern TCHAR szAppIpsPath[MAX_PATH];
|
||||
extern TCHAR szAppIconsPath[MAX_PATH];
|
||||
extern TCHAR szAppArchivesPath[MAX_PATH];
|
||||
|
|
|
@ -42,7 +42,9 @@ int ConfigAppLoad()
|
|||
|
||||
VAR(nIniVersion);
|
||||
VAR(nVidSelect); // video mode select
|
||||
VAR(bBurnUseASMCPUEmulation); // if you have a poor mans PC
|
||||
VAR(bVidFullStretch);
|
||||
|
||||
VAR(nAutoFireRate);
|
||||
|
||||
// Other
|
||||
STR(szAppRomPaths[0]);
|
||||
|
@ -53,6 +55,18 @@ int ConfigAppLoad()
|
|||
STR(szAppRomPaths[5]);
|
||||
STR(szAppRomPaths[6]);
|
||||
STR(szAppRomPaths[7]);
|
||||
STR(szAppRomPaths[8]);
|
||||
STR(szAppRomPaths[9]);
|
||||
STR(szAppRomPaths[10]);
|
||||
STR(szAppRomPaths[11]);
|
||||
STR(szAppRomPaths[12]);
|
||||
STR(szAppRomPaths[13]);
|
||||
STR(szAppRomPaths[14]);
|
||||
STR(szAppRomPaths[15]);
|
||||
STR(szAppRomPaths[16]);
|
||||
STR(szAppRomPaths[17]);
|
||||
STR(szAppRomPaths[18]);
|
||||
STR(szAppRomPaths[19]);
|
||||
#undef STR
|
||||
#undef FLT
|
||||
#undef VAR
|
||||
|
@ -86,8 +100,11 @@ int ConfigAppSave()
|
|||
fprintf(h,"\n// video mode 0 = standard SDL 1= (very expiermental) opengl\n");
|
||||
VAR(nVidSelect); // video mode select
|
||||
|
||||
fprintf(h,"\n// use asm cpu cores (i.e. you need to buy a new PC)\n");
|
||||
VAR(bBurnUseASMCPUEmulation);
|
||||
fprintf(h,"\n// If non-zero, allow stretching of the image to any size\n");
|
||||
VAR(bVidFullStretch);
|
||||
|
||||
fprintf(h,"\n// Auto-Fire Rate, non-linear - use the GUI to change this setting!\n");
|
||||
VAR(nAutoFireRate);
|
||||
|
||||
fprintf(h,"\n// The paths to search for rom zips. (include trailing backslash)\n");
|
||||
STR(szAppRomPaths[0]);
|
||||
|
@ -98,6 +115,18 @@ int ConfigAppSave()
|
|||
STR(szAppRomPaths[5]);
|
||||
STR(szAppRomPaths[6]);
|
||||
STR(szAppRomPaths[7]);
|
||||
STR(szAppRomPaths[8]);
|
||||
STR(szAppRomPaths[9]);
|
||||
STR(szAppRomPaths[10]);
|
||||
STR(szAppRomPaths[11]);
|
||||
STR(szAppRomPaths[12]);
|
||||
STR(szAppRomPaths[13]);
|
||||
STR(szAppRomPaths[14]);
|
||||
STR(szAppRomPaths[15]);
|
||||
STR(szAppRomPaths[16]);
|
||||
STR(szAppRomPaths[17]);
|
||||
STR(szAppRomPaths[18]);
|
||||
STR(szAppRomPaths[19]);
|
||||
|
||||
fprintf(h,"\n\n\n");
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ static int DoLibInit() // Do Init of Burn library driver
|
|||
|
||||
BzipClose();
|
||||
|
||||
//ProgressDestroy();
|
||||
|
||||
if (nRet) {
|
||||
return 1;
|
||||
} else {
|
||||
|
@ -58,10 +60,10 @@ int DrvInit(int nDrvNum, bool bRestore)
|
|||
|
||||
nBurnSoundRate = 0; // Assume no sound
|
||||
pBurnSoundOut = NULL;
|
||||
// if (bAudOkay) {
|
||||
// nBurnSoundRate = nAudSampleRate;
|
||||
// nBurnSoundLen = nAudSegLen;
|
||||
// }
|
||||
if (bAudOkay) {
|
||||
nBurnSoundRate = nAudSampleRate[0];
|
||||
nBurnSoundLen = nAudSegLen;
|
||||
}
|
||||
nBurnDrvSelect[0] = nDrvNum; // Set the driver number
|
||||
|
||||
// Define nMaxPlayers early; GameInpInit() needs it (normally defined in DoLibInit()).
|
||||
|
@ -106,7 +108,7 @@ int DrvExit()
|
|||
|
||||
if (nBurnDrvSelect[0] < nBurnDrvCount) {
|
||||
if (bSaveRAM) {
|
||||
|
||||
|
||||
bSaveRAM = false;
|
||||
}
|
||||
|
||||
|
@ -133,7 +135,6 @@ int DrvExit()
|
|||
|
||||
int ProgressUpdateBurner(double dProgress, const TCHAR* pszText, bool bAbs)
|
||||
{
|
||||
printf(".");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
|
||||
#include "burner.h"
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#endif
|
||||
// Game patching
|
||||
|
||||
#define UTF8_SIGNATURE "\xef\xbb\xbf"
|
||||
#define IPS_SIGNATURE "PATCH"
|
||||
#define IPS_TAG_EOF "EOF"
|
||||
#define IPS_EXT ".ips"
|
||||
|
||||
#define BYTE3_TO_UINT(bp) \
|
||||
(((unsigned int)(bp)[0] << 16) & 0x00FF0000) | \
|
||||
(((unsigned int)(bp)[1] << 8) & 0x0000FF00) | \
|
||||
((unsigned int)(bp)[2] & 0x000000FF)
|
||||
|
||||
#define BYTE2_TO_UINT(bp) \
|
||||
(((unsigned int)(bp)[0] << 8) & 0xFF00) | \
|
||||
((unsigned int) (bp)[1] & 0x00FF)
|
||||
|
||||
bool bDoIpsPatch = FALSE;
|
||||
|
||||
static void PatchFile(const char* ips_path, UINT8* base)
|
||||
{
|
||||
char buf[6];
|
||||
FILE* f = NULL;
|
||||
int Offset, Size;
|
||||
UINT8* mem8 = NULL;
|
||||
|
||||
if (NULL == (f = fopen(ips_path, "rb")))
|
||||
return;
|
||||
|
||||
memset(buf, 0, sizeof buf);
|
||||
fread(buf, 1, 5, f);
|
||||
if (strcmp(buf, IPS_SIGNATURE)) {
|
||||
return;
|
||||
} else {
|
||||
UINT8 ch = 0;
|
||||
int bRLE = 0;
|
||||
while (!feof(f)) {
|
||||
// read patch address offset
|
||||
fread(buf, 1, 3, f);
|
||||
buf[3] = 0;
|
||||
if (strcmp(buf, IPS_TAG_EOF) == 0)
|
||||
break;
|
||||
|
||||
Offset = BYTE3_TO_UINT(buf);
|
||||
|
||||
// read patch length
|
||||
fread(buf, 1, 2, f);
|
||||
Size = BYTE2_TO_UINT(buf);
|
||||
|
||||
bRLE = (Size == 0);
|
||||
if (bRLE) {
|
||||
fread(buf, 1, 2, f);
|
||||
Size = BYTE2_TO_UINT(buf);
|
||||
ch = fgetc(f);
|
||||
}
|
||||
|
||||
while (Size--) {
|
||||
mem8 = base + Offset;
|
||||
Offset++;
|
||||
*mem8 = bRLE ? ch : fgetc(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
static void DoPatchGame(const char* patch_name, char* game_name, UINT8* base)
|
||||
{
|
||||
char s[MAX_PATH];
|
||||
char* p = NULL;
|
||||
char* rom_name = NULL;
|
||||
char* ips_name = NULL;
|
||||
FILE* fp = NULL;
|
||||
unsigned long nIpsSize;
|
||||
|
||||
if ((fp = fopen(patch_name, "rb")) != NULL) {
|
||||
// get ips size
|
||||
fseek(fp, 0, SEEK_END);
|
||||
nIpsSize = ftell(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
|
||||
while (!feof(fp)) {
|
||||
if (fgets(s, sizeof s, fp) != NULL) {
|
||||
p = s;
|
||||
|
||||
// skip UTF-8 sig
|
||||
if (strncmp(p, UTF8_SIGNATURE, strlen(UTF8_SIGNATURE)) == 0)
|
||||
p += strlen(UTF8_SIGNATURE);
|
||||
|
||||
if (p[0] == '[') // '['
|
||||
break;
|
||||
|
||||
rom_name = strtok(p, " \t\r\n");
|
||||
if (!rom_name)
|
||||
continue;
|
||||
if (*rom_name == '#')
|
||||
continue;
|
||||
if (_stricmp(rom_name, game_name))
|
||||
continue;
|
||||
|
||||
ips_name = strtok(NULL, " \t\r\n");
|
||||
if (!ips_name)
|
||||
continue;
|
||||
|
||||
// skip CRC check
|
||||
strtok(NULL, "\r\n");
|
||||
|
||||
char ips_path[MAX_PATH];
|
||||
char ips_dir[MAX_PATH];
|
||||
TCHARToANSI(szAppIpsPath, ips_dir, sizeof(ips_dir));
|
||||
|
||||
if (strchr(ips_name, '\\')) {
|
||||
// ips in parent's folder
|
||||
sprintf(ips_path, "%s\\%s%s", ips_dir, ips_name, IPS_EXT);
|
||||
} else {
|
||||
sprintf(ips_path, "%s%s\\%s%s", ips_dir, BurnDrvGetTextA(DRV_NAME), ips_name, IPS_EXT);
|
||||
}
|
||||
|
||||
PatchFile(ips_path, base);
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
void IpsApplyPatches(UINT8* base, char* rom_name)
|
||||
{
|
||||
#if 0
|
||||
char ips_data[MAX_PATH];
|
||||
|
||||
int nActivePatches = GetIpsNumActivePatches();
|
||||
|
||||
for (int i = 0; i < nActivePatches; i++) {
|
||||
memset(ips_data, 0, MAX_PATH);
|
||||
TCHARToANSI(szIpsActivePatches[i], ips_data, sizeof(ips_data));
|
||||
DoPatchGame(ips_data, rom_name, base);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void IpsPatchExit()
|
||||
{
|
||||
bDoIpsPatch = FALSE;
|
||||
}
|
|
@ -14,27 +14,6 @@ probably many other things.
|
|||
int nAppVirtualFps = 6000; // App fps * 100
|
||||
bool bRunPause=0;
|
||||
bool bAlwaysProcessKeyboardInput=0;
|
||||
TCHAR szAppHiscorePath[MAX_PATH] = _T("support/hiscores/");
|
||||
TCHAR szAppSamplesPath[MAX_PATH] = _T("support/samples/");
|
||||
TCHAR szAppCheatsPath[MAX_PATH] = _T("support/cheats/");
|
||||
bool bDoIpsPatch;
|
||||
|
||||
TCHAR *GetIsoPath()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Reinitialise(void)
|
||||
{
|
||||
}
|
||||
|
||||
void IpsApplyPatches(UINT8 *, char *)
|
||||
{
|
||||
}
|
||||
|
||||
void wav_pause(bool bResume)
|
||||
{
|
||||
}
|
||||
|
||||
void init_emu(int gamenum)
|
||||
{
|
||||
|
@ -55,27 +34,37 @@ void ProcessCommandLine(int argc, char *argv[])
|
|||
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
#undef main
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
UINT32 i=0;
|
||||
|
||||
ConfigAppLoad();
|
||||
|
||||
|
||||
ConfigAppLoad();
|
||||
|
||||
CheckFirstTime(); // check for first time run
|
||||
|
||||
|
||||
SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO);
|
||||
|
||||
BurnLibInit();
|
||||
BurnLibInit();
|
||||
|
||||
SDL_WM_SetCaption( "FBA, SDL port.", "FBA, SDL port.");
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
int c;
|
||||
printf ("Usage: fbasdl <romname>\n ie: fbasdl uopoko\n Note: no extension.\n\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
for (i = 0; i < nBurnDrvCount; i++) {
|
||||
//nBurnDrvSelect[0] = i;
|
||||
nBurnDrvActive = i;
|
||||
if (strcmp(BurnDrvGetTextA(0), argv[1]) == 0) {
|
||||
//nBurnDrvSelect[0] = i;
|
||||
nBurnDrvActive = i;
|
||||
if (strcmp(BurnDrvGetTextA(0), argv[1]) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +77,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
InputInit();
|
||||
init_emu(i);
|
||||
|
||||
|
||||
RunMessageLoop();
|
||||
InputExit();
|
||||
|
||||
|
|
|
@ -0,0 +1,519 @@
|
|||
// ---------------------------------------------------------------------------------------
|
||||
// NeoGeo CD Game Info Module (by CaptainCPS-X)
|
||||
// ---------------------------------------------------------------------------------------
|
||||
#include "burner.h"
|
||||
#include "neocdlist.h"
|
||||
|
||||
struct NGCDGAME games[] =
|
||||
{
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------------------//
|
||||
// * Name * Title * Year * Company * Game ID //
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------------------//
|
||||
{ _T("nam1975") , _T("NAM-1975") , _T("1990") , _T("SNK") , 0x0001 }, //
|
||||
{ _T("bstars") , _T("Baseball Stars Professional") , _T("1991") , _T("SNK") , 0x0002 }, //
|
||||
{ _T("tpgolf") , _T("Top Player's Golf") , _T("1990") , _T("SNK") , 0x0003 }, //
|
||||
{ _T("mahretsu") , _T("Mahjong Kyo Retsuden - Nishi Nihon Hen") , _T("1990") , _T("SNK") , 0x0004 }, //
|
||||
{ _T("maglord") , _T("Magician Lord") , _T("1990") , _T("ADK") , 0x0005 }, //
|
||||
{ _T("ridhero") , _T("Riding Hero") , _T("1991") , _T("SNK") , 0x0006 }, //
|
||||
{ _T("alpham2") , _T("Alpha Mission II / ASO II - Last Guardian") , _T("1994") , _T("SNK") , 0x0007 }, //
|
||||
{ _T("ncombat") , _T("Ninja Combat") , _T("1990") , _T("SNK/ADK") , 0x0009 }, //
|
||||
{ _T("cyberlip") , _T("Cyber-Lip") , _T("1991") , _T("SNK") , 0x0010 }, //
|
||||
{ _T("superspy") , _T("The Super Spy") , _T("1990") , _T("SNK") , 0x0011 }, //
|
||||
{ _T("mutnat") , _T("Mutation Nation") , _T("1995") , _T("SNK") , 0x0014 }, //
|
||||
{ _T("sengoku") , _T("Sengoku / Sengoku Denshou") , _T("1994") , _T("SNK") , 0x0017 }, //
|
||||
{ _T("burningf") , _T("Burning Fight") , _T("1994") , _T("SNK") , 0x0018 }, //
|
||||
{ _T("lbowling") , _T("League Bowling") , _T("1994") , _T("SNK") , 0x0019 }, //
|
||||
{ _T("gpilots") , _T("Ghost Pilots") , _T("1991") , _T("SNK") , 0x0020 }, //
|
||||
{ _T("joyjoy") , _T("Puzzled / Joy Joy Kid") , _T("1990") , _T("SNK") , 0x0021 }, //
|
||||
{ _T("bjourney") , _T("Blue's Journey / Raguy") , _T("1990") , _T("SNK/ADK") , 0x0022 }, //
|
||||
{ _T("lresort") , _T("Last Resort") , _T("1994") , _T("SNK") , 0x0024 }, //
|
||||
{ _T("2020bb") , _T("2020 Super Baseball") , _T("1994") , _T("SNK") , 0x0030 }, //
|
||||
{ _T("socbrawl") , _T("Soccer Brawl") , _T("1991") , _T("SNK") , 0x0031 }, //
|
||||
{ _T("roboarmy") , _T("Robo Army") , _T("1991") , _T("SNK") , 0x0032 }, //
|
||||
{ _T("fatfury") , _T("Fatal Fury - The Battle of Fury") , _T("1994") , _T("SNK") , 0x0033 }, //
|
||||
{ _T("fbfrenzy") , _T("Football Frenzy") , _T("1994") , _T("SNK") , 0x0034 }, //
|
||||
{ _T("crswords") , _T("Crossed Swords") , _T("1994") , _T("SNK/ADK") , 0x0037 }, //
|
||||
{ _T("rallych") , _T("Rally Chase") , _T("1991") , _T("SNK/ADK") , 0x0038 }, //
|
||||
{ _T("kotm2") , _T("King of the Monsters 2") , _T("1992") , _T("SNK") , 0x0039 }, //
|
||||
{ _T("sengoku2") , _T("Sengoku 2 / Sengoku Denshou 2") , _T("1994") , _T("SNK") , 0x0040 }, //
|
||||
{ _T("bstars2") , _T("Baseball Stars 2") , _T("1992") , _T("SNK") , 0x0041 }, //
|
||||
{ _T("3countb") , _T("3 Count Bout / Fire Suplex") , _T("1995") , _T("SNK") , 0x0043 }, //
|
||||
{ _T("aof") , _T("Art of Fighting / Ryuuko no Ken") , _T("1994") , _T("SNK") , 0x0044 }, //
|
||||
{ _T("samsho") , _T("Samurai Shodown / Samurai Spirits") , _T("1993") , _T("SNK") , 0x0045 }, //
|
||||
{ _T("tophuntr") , _T("Top Hunter - Roddy & Cathy") , _T("1994") , _T("SNK") , 0x0046 }, //
|
||||
{ _T("fatfury2") , _T("Fatal Fury 2 / Garou Densetsu 2 - Aratanaru Tatakai") , _T("1994") , _T("SNK") , 0x0047 }, //
|
||||
{ _T("janshin") , _T("Janshin Densetsu - Quest of the Jongmaster") , _T("1995") , _T("Yubis") , 0x0048 }, //
|
||||
{ _T("ncommand") , _T("Ninja Commando") , _T("1992") , _T("SNK") , 0x0050 }, //
|
||||
{ _T("viewpoin") , _T("Viewpoint") , _T("1992") , _T("Sammy/Aicom") , 0x0051 }, //
|
||||
{ _T("ssideki") , _T("Super Sidekicks / Tokuten Oh") , _T("1993") , _T("SNK") , 0x0052 }, //
|
||||
{ _T("wh1") , _T("World Heroes") , _T("1992") , _T("ADK") , 0x0053 }, //
|
||||
{ _T("crsword2") , _T("Crossed Swords II") , _T("1995") , _T("SNK/ADK") , 0x0054 }, //
|
||||
{ _T("kof94") , _T("The King of Fighters '94 (JP)") , _T("1994") , _T("SNK") , 0x0055 }, //
|
||||
{ _T("kof94ju") , _T("The King of Fighters '94 (JP-US)") , _T("1994") , _T("SNK") , 0x1055 }, // custom id
|
||||
{ _T("aof2") , _T("Art of Fighting 2 / Ryuuko no Ken 2") , _T("1994") , _T("SNK") , 0x0056 }, //
|
||||
{ _T("wh2") , _T("World Heroes 2") , _T("1995") , _T("SNK/ADK") , 0x0057 }, //
|
||||
{ _T("fatfursp") , _T("Fatal Fury Special / Garou Densetsu Special") , _T("1994") , _T("SNK") , 0x0058 }, //
|
||||
{ _T("savagere") , _T("Savage Reign / Fu'un Mokujiroku - Kakutou Sousei") , _T("1995") , _T("SNK") , 0x0059 }, //
|
||||
{ _T("ssideki2") , _T("Super Sidekicks 2 / Tokuten Oh 2") , _T("1994") , _T("SNK") , 0x0061 }, //
|
||||
{ _T("samsho2") , _T("Samurai Shodown 2 / Shin Samurai Spirits") , _T("1994") , _T("SNK") , 0x0063 }, //
|
||||
{ _T("wh2j") , _T("World Heroes 2 Jet") , _T("1995") , _T("SNK/ADK") , 0x0064 }, //
|
||||
{ _T("wjammers") , _T("Windjammers / Flying Power Disc") , _T("1994") , _T("Data East") , 0x0065 }, //
|
||||
{ _T("karnovr") , _T("Karnov's Revenge / Fighters History Dynamite") , _T("1994") , _T("Data East") , 0x0066 }, //
|
||||
{ _T("pspikes2") , _T("Power Spikes II") , _T("1994") , _T("Video System") , 0x0068 }, //
|
||||
{ _T("aodk") , _T("Aggressors of Dark Kombat / Tsuukai GanGan Koushinkyoku") , _T("1994"), _T("SNK/ADK") , 0x0074 }, //
|
||||
{ _T("sonicwi2") , _T("Aero Fighters 2 / Sonic Wings 2") , _T("1994") , _T("Video System") , 0x0075 }, //
|
||||
{ _T("galaxyfg") , _T("Galaxy Fight - Universal Warriors") , _T("1995") , _T("Sunsoft") , 0x0078 }, //
|
||||
{ _T("strhoop") , _T("Street Hoop / Dunk Dream") , _T("1994") , _T("Data East") , 0x0079 }, //
|
||||
{ _T("quizkof") , _T("Quiz King of Fighters") , _T("1993") , _T("SNK/Saurus") , 0x0080 }, //
|
||||
{ _T("ssideki3") , _T("Super Sidekicks 3 - The Next Glory / Tokuten Oh 3 - Eikoue No Chousen"), _T("1995") , _T("SNK") , 0x0081 }, //
|
||||
{ _T("doubledr") , _T("Double Dragon") , _T("1995") , _T("Technos") , 0x0082 }, //
|
||||
{ _T("pbobblen") , _T("Puzzle Bobble / Bust-A-Move") , _T("1994") , _T("SNK") , 0x0083 }, //
|
||||
{ _T("kof95") , _T("The King of Fighters '95 (JP-US)") , _T("1995") , _T("SNK") , 0x0084 }, //
|
||||
{ _T("kof95r1") , _T("The King of Fighters '95 (JP-US)(Rev 1)") , _T("1995") , _T("SNK") , 0x1084 }, //
|
||||
{ _T("ssrpg") , _T("Shinsetsu Samurai Spirits - Bushidohretsuden") , _T("1997") , _T("SNK") , 0x0085 }, //
|
||||
{ _T("samsho3") , _T("Samurai Shodown 3 / Samurai Spirits 3") , _T("1995") , _T("SNK") , 0x0087 }, //
|
||||
{ _T("stakwin") , _T("Stakes Winner - GI Kanzen Seiha Heno Machi") , _T("1995") , _T("Saurus") , 0x0088 }, //
|
||||
{ _T("pulstar") , _T("Pulstar") , _T("1995") , _T("Aicom") , 0x0089 }, //
|
||||
{ _T("whp") , _T("World Heroes Perfect") , _T("1995") , _T("ADK") , 0x0090 }, //
|
||||
{ _T("kabukikl") , _T("Kabuki Klash / Tengai Makyou Shinden - Far East of Eden") , _T("1995"), _T("Hudson") , 0x0092 }, //
|
||||
{ _T("gowcaizr") , _T("Voltage Fighter Gowcaizer / Choujin Gakuen Gowcaizer"), _T("1995") , _T("Technos") , 0x0094 }, //
|
||||
{ _T("rbff1") , _T("Real Bout Fatal Fury") , _T("1995") , _T("SNK") , 0x0095 }, //
|
||||
{ _T("aof3") , _T("Art of Fighting 3: Path of the Warrior") , _T("1996") , _T("SNK") , 0x0096 }, //
|
||||
{ _T("sonicwi3") , _T("Aero Fighters 3 / Sonic Wings 3") , _T("1995") , _T("SNK") , 0x0097 }, //
|
||||
{ _T("fromanc2") , _T("Idol Mahjong Final Romance 2") , _T("1995") , _T("Video Systems") , 0x0098 }, //
|
||||
{ _T("turfmast") , _T("Neo Turf Masters / Big Tournament Golf") , _T("1996") , _T("Nazca") , 0x0200 }, //
|
||||
{ _T("mslug") , _T("Metal Slug - Super Vehicle-001") , _T("1996") , _T("Nazca") , 0x0201 }, //
|
||||
{ _T("mosyougi") , _T("Shougi no Tatsujin - Master of Syougi") , _T("1995") , _T("ADK") , 0x0203 }, //
|
||||
{ _T("adkworld") , _T("ADK World / ADK Special") , _T("1995") , _T("ADK") , 0x0204 }, //
|
||||
{ _T("ngcdsp") , _T("Neo Geo CD Special") , _T("1995") , _T("SNK") , 0x0205 }, //
|
||||
{ _T("zintrick") , _T("Zintrick / Oshidashi Zintrick") , _T("1996") , _T("ADK") , 0x0211 }, //
|
||||
{ _T("overtop") , _T("OverTop") , _T("1996") , _T("ADK") , 0x0212 }, //
|
||||
{ _T("neodrift") , _T("Neo DriftOut") , _T("1996") , _T("Visco") , 0x0213 }, //
|
||||
{ _T("kof96") , _T("The King of Fighters '96") , _T("1996") , _T("SNK") , 0x0214 }, //
|
||||
{ _T("ninjamas") , _T("Ninja Master's - Haou Ninpou-Chou") , _T("1996") , _T("ADK/SNK") , 0x0217 }, //
|
||||
{ _T("ragnagrd") , _T("Ragnagard / Shinouken") , _T("1996") , _T("Saurus") , 0x0218 }, //
|
||||
{ _T("pgoal") , _T("Pleasuregoal - 5 on 5 Mini Soccer / Futsal") , _T("1996") , _T("Saurus") , 0x0219 }, //
|
||||
{ _T("ironclad") , _T("Ironclad / Choutetsu Brikin'ger") , _T("1996") , _T("Saurus") , 0x0220 }, //
|
||||
{ _T("magdrop2") , _T("Magical Drop 2") , _T("1996") , _T("Data East") , 0x0221 }, //
|
||||
{ _T("samsho4") , _T("Samurai Shodown IV - Amakusa's Revenge") , _T("1996") , _T("SNK") , 0x0222 }, //
|
||||
{ _T("rbffspec") , _T("Real Bout Fatal Fury Special") , _T("1996") , _T("SNK") , 0x0223 }, //
|
||||
{ _T("twinspri") , _T("Twinkle Star Sprites") , _T("1996") , _T("ADK") , 0x0224 }, //
|
||||
{ _T("kof96ngc") , _T("The King of Fighters '96 NEOGEO Collection") , _T("1996") , _T("SNK") , 0x0229 }, //
|
||||
{ _T("breakers") , _T("Breakers") , _T("1996") , _T("Visco") , 0x0230 }, //
|
||||
{ _T("kof97") , _T("The King of Fighters '97") , _T("1997") , _T("SNK") , 0x0232 }, //
|
||||
{ _T("lastblad") , _T("The Last Blade / Bakumatsu Roman - Gekka no Kenshi") , _T("1997") , _T("SNK") , 0x0234 }, //
|
||||
{ _T("rbff2") , _T("Real Bout Fatal Fury 2 / Garou Densetsu 2 - Aratanaru Tatakai"), _T("1998"), _T("SNK") , 0x0240 }, //
|
||||
{ _T("mslug2") , _T("Metal Slug 2 - Super Vehicle-001/II") , _T("1998") , _T("SNK") , 0x0241 }, //
|
||||
{ _T("kof98") , _T("The King of Fighters '98 - The Slugfest") , _T("1998") , _T("SNK") , 0x0242 }, //
|
||||
{ _T("lastbld2") , _T("The Last Blade 2") , _T("1998") , _T("SNK") , 0x0243 }, //
|
||||
{ _T("kof99") , _T("The King of Fighters '99 - Millennium Battle") , _T("1999") , _T("SNK") , 0x0251 }, //
|
||||
{ _T("fatfury3") , _T("Fatal Fury 3 - Road to the Final Victory / Garou Densetsu 3 - Harukanaru Tatakai"), _T("1995"), _T("SNK"), 0x069c }, //
|
||||
};
|
||||
|
||||
NGCDGAME* GetNeoGeoCDInfo(unsigned int nID)
|
||||
{
|
||||
for(unsigned int nGame = 0; nGame < (sizeof(games) / sizeof(NGCDGAME)); nGame++) {
|
||||
if(nID == games[nGame].id ) {
|
||||
return &games[nGame];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Update the main window title
|
||||
void SetNeoCDTitle(TCHAR* pszTitle)
|
||||
{
|
||||
TCHAR szText[1024] = _T("");
|
||||
_stprintf(szText, _T(APP_TITLE) _T( " v%.20s") _T(SEPERATOR_1) _T("%s") _T(SEPERATOR_1) _T("%s"), szAppBurnVer, BurnDrvGetText(DRV_FULLNAME), pszTitle);
|
||||
#ifdef BUILD_WIN32
|
||||
SetWindowText(hScrnWnd, szText);
|
||||
#endif
|
||||
}
|
||||
|
||||
NGCDGAME* game;
|
||||
|
||||
// Get the title
|
||||
int GetNeoCDTitle(unsigned int nGameID)
|
||||
{
|
||||
game = (NGCDGAME*)malloc(sizeof(NGCDGAME));
|
||||
memset(game, 0, sizeof(NGCDGAME));
|
||||
|
||||
if(GetNeoGeoCDInfo(nGameID))
|
||||
{
|
||||
memcpy(game, GetNeoGeoCDInfo(nGameID), sizeof(NGCDGAME));
|
||||
|
||||
bprintf(PRINT_NORMAL, _T(" Title: %s \n") , game->pszTitle);
|
||||
bprintf(PRINT_NORMAL, _T(" Shortname: %s \n") , game->pszName);
|
||||
bprintf(PRINT_NORMAL, _T(" Year: %s \n") , game->pszYear);
|
||||
bprintf(PRINT_NORMAL, _T(" Company: %s \n") , game->pszCompany);
|
||||
|
||||
// Update the main window title
|
||||
SetNeoCDTitle(game->pszTitle);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
game = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void iso9660_ReadOffset(unsigned char *Dest, FILE* fp, unsigned int lOffset, unsigned int lSize, unsigned int lLength)
|
||||
{
|
||||
if(fp == NULL) return;
|
||||
if (Dest == NULL) return;
|
||||
|
||||
fseek(fp, lOffset, SEEK_SET);
|
||||
fread(Dest, lLength, lSize, fp);
|
||||
}
|
||||
|
||||
static void NeoCDList_iso9660_CheckDirRecord(FILE* fp, int nSector)
|
||||
{
|
||||
int nSectorLength = 2048;
|
||||
//int nFile = 0;
|
||||
unsigned int lBytesRead = 0;
|
||||
//int nLen = 0;
|
||||
unsigned int lOffset = 0;
|
||||
bool bNewSector = false;
|
||||
bool bRevisionQueve = false;
|
||||
int nRevisionQueveID = 0;
|
||||
|
||||
lOffset = (nSector * nSectorLength);
|
||||
|
||||
unsigned char* nLenDR = (unsigned char*)malloc(1 * sizeof(unsigned char));
|
||||
unsigned char* Flags = (unsigned char*)malloc(1 * sizeof(unsigned char));
|
||||
unsigned char* ExtentLoc = (unsigned char*)malloc(8 * sizeof(unsigned char));
|
||||
unsigned char* Data = (unsigned char*)malloc(0x10b * sizeof(unsigned char));
|
||||
unsigned char* LEN_FI = (unsigned char*)malloc(1 * sizeof(unsigned char));
|
||||
char *File = (char*)malloc(32 * sizeof(char));
|
||||
|
||||
while(1)
|
||||
{
|
||||
iso9660_ReadOffset(nLenDR, fp, lOffset, 1, sizeof(unsigned char));
|
||||
|
||||
if(nLenDR[0] == 0x22) {
|
||||
lOffset += nLenDR[0];
|
||||
lBytesRead += nLenDR[0];
|
||||
continue;
|
||||
}
|
||||
|
||||
if(nLenDR[0] < 0x22)
|
||||
{
|
||||
if(bNewSector)
|
||||
{
|
||||
if(bRevisionQueve) {
|
||||
bRevisionQueve = false;
|
||||
|
||||
GetNeoCDTitle(nRevisionQueveID);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
nLenDR[0] = 0;
|
||||
iso9660_ReadOffset(nLenDR, fp, lOffset + 1, 1, sizeof(unsigned char));
|
||||
|
||||
if(nLenDR[0] < 0x22) {
|
||||
lOffset += (2048 - lBytesRead);
|
||||
lBytesRead = 0;
|
||||
bNewSector = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
bNewSector = false;
|
||||
|
||||
iso9660_ReadOffset(Flags, fp, lOffset + 25, 1, sizeof(unsigned char));
|
||||
|
||||
if(!(Flags[0] & (1 << 1)))
|
||||
{
|
||||
iso9660_ReadOffset(ExtentLoc, fp, lOffset + 2, 8, sizeof(unsigned char));
|
||||
|
||||
char szValue[9];
|
||||
sprintf(szValue, "%02x%02x%02x%02x", ExtentLoc[4], ExtentLoc[5], ExtentLoc[6], ExtentLoc[7]);
|
||||
|
||||
unsigned int nValue = 0;
|
||||
sscanf(szValue, "%x", &nValue);
|
||||
|
||||
iso9660_ReadOffset(Data, fp, nValue * 2048, 0x10a, sizeof(unsigned char));
|
||||
|
||||
char szData[8];
|
||||
sprintf(szData, "%c%c%c%c%c%c%c", Data[0x100], Data[0x101], Data[0x102], Data[0x103], Data[0x104], Data[0x105], Data[0x106]);
|
||||
|
||||
if(!strncmp(szData, "NEO-GEO", 7))
|
||||
{
|
||||
char id[] = "0000";
|
||||
sprintf(id, "%02X%02X", Data[0x108], Data[0x109]);
|
||||
|
||||
unsigned int nID = 0;
|
||||
sscanf(id, "%x", &nID);
|
||||
|
||||
iso9660_ReadOffset(LEN_FI, fp, lOffset + 32, 1, sizeof(unsigned char));
|
||||
|
||||
iso9660_ReadOffset((unsigned char*)File, fp, lOffset + 33, LEN_FI[0], sizeof(char));
|
||||
strncpy(File, File, LEN_FI[0]);
|
||||
File[LEN_FI[0]] = 0;
|
||||
|
||||
// King of Fighters '94, The (1994)(SNK)(JP)
|
||||
// 10-6-1994 (P1.PRG)
|
||||
if(nID == 0x0055 && Data[0x67] == 0xDE) {
|
||||
// ...continue
|
||||
}
|
||||
|
||||
// King of Fighters '94, The (1994)(SNK)(JP-US)
|
||||
// 11-21-1994 (P1.PRG)
|
||||
if(nID == 0x0055 && Data[0x67] == 0xE6) {
|
||||
// Change to custom revision id
|
||||
nID = 0x1055;
|
||||
}
|
||||
|
||||
// King of Fighters '95, The (1995)(SNK)(JP-US)[!][NGCD-084 MT B01, B03-B06, NGCD-084E MT B01]
|
||||
// 9-11-1995 (P1.PRG)
|
||||
if(nID == 0x0084 && Data[0x6C] == 0xC0) {
|
||||
// ... continue
|
||||
}
|
||||
|
||||
// King of Fighters '95, The (1995)(SNK)(JP-US)[!][NGCD-084 MT B10, NGCD-084E MT B03]
|
||||
// 10-5-1995 (P1.PRG)
|
||||
if(nID == 0x0084 && Data[0x6C] == 0xFF) {
|
||||
// Change to custom revision id
|
||||
nID = 0x1084;
|
||||
}
|
||||
|
||||
// King of Fighters '96 NEOGEO Collection, The
|
||||
if(nID == 0x0229) {
|
||||
bRevisionQueve = false;
|
||||
|
||||
GetNeoCDTitle(nID);
|
||||
break;
|
||||
}
|
||||
|
||||
// King of Fighters '96, The
|
||||
if(nID == 0x0214) {
|
||||
bRevisionQueve = true;
|
||||
nRevisionQueveID = nID;
|
||||
lOffset += nLenDR[0];
|
||||
lBytesRead += nLenDR[0];
|
||||
continue;
|
||||
}
|
||||
|
||||
GetNeoCDTitle(nID);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lOffset += nLenDR[0];
|
||||
lBytesRead += nLenDR[0];
|
||||
}
|
||||
|
||||
if (nLenDR) {
|
||||
free(nLenDR);
|
||||
nLenDR = NULL;
|
||||
}
|
||||
|
||||
if (Flags) {
|
||||
free(Flags);
|
||||
Flags = NULL;
|
||||
}
|
||||
|
||||
if (ExtentLoc) {
|
||||
free(ExtentLoc);
|
||||
ExtentLoc = NULL;
|
||||
}
|
||||
|
||||
if (Data) {
|
||||
free(Data);
|
||||
Data = NULL;
|
||||
}
|
||||
|
||||
if (LEN_FI) {
|
||||
free(LEN_FI);
|
||||
LEN_FI = NULL;
|
||||
}
|
||||
|
||||
if (File) {
|
||||
free(File);
|
||||
File = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Check the specified ISO, and proceed accordingly
|
||||
static int NeoCDList_CheckISO(TCHAR* pszFile)
|
||||
{
|
||||
if(!pszFile) {
|
||||
// error
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Make sure we have a valid ISO file extension...
|
||||
if(_tcsstr(pszFile, _T(".iso")) || _tcsstr(pszFile, _T(".ISO")) )
|
||||
{
|
||||
FILE* fp = _tfopen(pszFile, _T("rb"));
|
||||
if(fp)
|
||||
{
|
||||
// Read ISO and look for 68K ROM standard program header, ID is always there
|
||||
// Note: This function works very quick, doesn't compromise performance :)
|
||||
// it just read each sector first 264 bytes aproximately only.
|
||||
|
||||
// Get ISO Size (bytes)
|
||||
fseek(fp, 0, SEEK_END);
|
||||
unsigned int lSize = 0;
|
||||
lSize = ftell(fp);
|
||||
//rewind(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
|
||||
// If it has at least 16 sectors proceed
|
||||
if(lSize > (2048 * 16))
|
||||
{
|
||||
// Check for Standard ISO9660 Identifier
|
||||
unsigned char IsoHeader[2048 * 16 + 1];
|
||||
unsigned char IsoCheck[6];
|
||||
|
||||
fread(IsoHeader, 1, 2048 * 16 + 1, fp); // advance to sector 16 and PVD Field 2
|
||||
fread(IsoCheck, 1, 5, fp); // get Standard Identifier Field from PVD
|
||||
|
||||
// Verify that we have indeed a valid ISO9660 MODE1/2048
|
||||
if(!memcmp(IsoCheck, "CD001", 5))
|
||||
{
|
||||
//bprintf(PRINT_NORMAL, _T(" Standard ISO9660 Identifier Found. \n"));
|
||||
iso9660_VDH vdh;
|
||||
|
||||
// Get Volume Descriptor Header
|
||||
memset(&vdh, 0, sizeof(vdh));
|
||||
//memcpy(&vdh, iso9660_ReadOffset(fp, (2048 * 16), sizeof(vdh)), sizeof(vdh));
|
||||
iso9660_ReadOffset((unsigned char*)&vdh, fp, 2048 * 16, 1, sizeof(vdh));
|
||||
|
||||
// Check for a valid Volume Descriptor Type
|
||||
if(vdh.vdtype == 0x01)
|
||||
{
|
||||
#if 0
|
||||
// This will fail on 64-bit due to differing variable sizes in the pvd struct
|
||||
// Get Primary Volume Descriptor
|
||||
iso9660_PVD pvd;
|
||||
memset(&pvd, 0, sizeof(pvd));
|
||||
//memcpy(&pvd, iso9660_ReadOffset(fp, (2048 * 16), sizeof(pvd)), sizeof(pvd));
|
||||
iso9660_ReadOffset((unsigned char*)&pvd, fp, 2048 * 16, 1, sizeof(pvd));
|
||||
|
||||
// ROOT DIRECTORY RECORD
|
||||
|
||||
// Handle Path Table Location
|
||||
char szRootSector[32];
|
||||
unsigned int nRootSector = 0;
|
||||
|
||||
sprintf(szRootSector, "%02X%02X%02X%02X",
|
||||
pvd.root_directory_record.location_of_extent[4],
|
||||
pvd.root_directory_record.location_of_extent[5],
|
||||
pvd.root_directory_record.location_of_extent[6],
|
||||
pvd.root_directory_record.location_of_extent[7]);
|
||||
|
||||
// Convert HEX string to Decimal
|
||||
sscanf(szRootSector, "%X", &nRootSector);
|
||||
#else
|
||||
// Just read from the file directly at the correct offset (0x8000 + 0x9e for the start of the root directory record)
|
||||
unsigned char buffer[8];
|
||||
char szRootSector[4];
|
||||
unsigned int nRootSector = 0;
|
||||
|
||||
fseek(fp, 0x809e, SEEK_SET);
|
||||
fread(buffer, 1, 8, fp);
|
||||
|
||||
sprintf(szRootSector, "%02x%02x%02x%02x", buffer[4], buffer[5], buffer[6], buffer[7]);
|
||||
|
||||
sscanf(szRootSector, "%x", &nRootSector);
|
||||
#endif
|
||||
|
||||
// Process the Root Directory Records
|
||||
NeoCDList_iso9660_CheckDirRecord(fp, nRootSector);
|
||||
|
||||
// Path Table Records are not processed, since NeoGeo CD should not have subdirectories
|
||||
// ...
|
||||
}
|
||||
} else {
|
||||
|
||||
//bprintf(PRINT_NORMAL, _T(" Standard ISO9660 Identifier Not Found, cannot continue. \n"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
//bprintf(PRINT_NORMAL, _T(" Couldn't open %s \n"), GetIsoPath());
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(fp) fclose(fp);
|
||||
|
||||
} else {
|
||||
|
||||
//bprintf(PRINT_NORMAL, _T(" File doesn't have a valid ISO extension [ .iso / .ISO ] \n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// This will do everything
|
||||
int GetNeoGeoCD_Identifier()
|
||||
{
|
||||
if(!GetIsoPath() || !IsNeoGeoCD()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Make sure we have a valid ISO file extension...
|
||||
if(_tcsstr(GetIsoPath(), _T(".iso")) || _tcsstr(GetIsoPath(), _T(".ISO")) )
|
||||
{
|
||||
if(_tfopen(GetIsoPath(), _T("rb")))
|
||||
{
|
||||
// Read ISO and look for 68K ROM standard program header, ID is always there
|
||||
// Note: This function works very quick, doesn't compromise performance :)
|
||||
// it just read each sector first 264 bytes aproximately only.
|
||||
NeoCDList_CheckISO(GetIsoPath());
|
||||
|
||||
} else {
|
||||
|
||||
bprintf(PRINT_NORMAL, _T(" Couldn't open %s \n"), GetIsoPath());
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
bprintf(PRINT_NORMAL, _T(" File doesn't have a valid ISO extension [ .iso / .ISO ] \n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int NeoCDInfo_Init()
|
||||
{
|
||||
NeoCDInfo_Exit();
|
||||
return GetNeoGeoCD_Identifier();
|
||||
}
|
||||
|
||||
TCHAR* NeoCDInfo_Text(int nText)
|
||||
{
|
||||
if(!game || !IsNeoGeoCD() || !bDrvOkay) return NULL;
|
||||
|
||||
switch(nText)
|
||||
{
|
||||
case DRV_NAME: return game->pszName;
|
||||
case DRV_FULLNAME: return game->pszTitle;
|
||||
case DRV_MANUFACTURER: return game->pszCompany;
|
||||
case DRV_DATE: return game->pszYear;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int NeoCDInfo_ID()
|
||||
{
|
||||
if(!game || !IsNeoGeoCD() || !bDrvOkay) return 0;
|
||||
return game->id;
|
||||
}
|
||||
|
||||
void NeoCDInfo_Exit()
|
||||
{
|
||||
if(game) {
|
||||
free(game);
|
||||
game = NULL;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
// Run module
|
||||
#include "burner.h"
|
||||
|
||||
|
||||
bool bAltPause = 0;
|
||||
|
||||
int bAlwaysDrawFrames = 0;
|
||||
|
@ -47,7 +46,6 @@ static void DisplayFPS()
|
|||
time_t temptime = clock();
|
||||
float fps = static_cast<float>(nFramesRendered - nPreviousFrames) * CLOCKS_PER_SEC / (temptime - fpstimer);
|
||||
sprintf(fpsstring, "%2.1f", fps);
|
||||
//VidSNewShortMsg(fpsstring, 0xDFDFFF, 480, 0);
|
||||
|
||||
fpstimer = temptime;
|
||||
nPreviousFrames = nFramesRendered;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
#include "burner.h"
|
||||
|
||||
void Reinitialise()
|
||||
{
|
||||
//POST_INITIALISE_MESSAGE;
|
||||
VidReInitialise();
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#include "burner.h"
|
||||
|
||||
TCHAR szAppPreviewsPath[MAX_PATH] = _T("support\\previews\\");
|
||||
TCHAR szAppTitlesPath[MAX_PATH] = _T("support\\titles\\");
|
||||
TCHAR szAppSelectPath[MAX_PATH] = _T("support\\select\\");
|
||||
TCHAR szAppVersusPath[MAX_PATH] = _T("support\\versus\\");
|
||||
TCHAR szAppHowtoPath[MAX_PATH] = _T("support\\howto\\");
|
||||
TCHAR szAppScoresPath[MAX_PATH] = _T("support\\scores\\");
|
||||
TCHAR szAppBossesPath[MAX_PATH] = _T("support\\bosses\\");
|
||||
TCHAR szAppGameoverPath[MAX_PATH] = _T("support\\gameover\\");
|
||||
TCHAR szAppFlyersPath[MAX_PATH] = _T("support\\flyers\\");
|
||||
TCHAR szAppMarqueesPath[MAX_PATH] = _T("support\\marquees\\");
|
||||
TCHAR szAppControlsPath[MAX_PATH] = _T("support\\controls\\");
|
||||
TCHAR szAppCabinetsPath[MAX_PATH] = _T("support\\cabinets\\");
|
||||
TCHAR szAppPCBsPath[MAX_PATH] = _T("support\\pcbs\\");
|
||||
TCHAR szAppCheatsPath[MAX_PATH] = _T("support\\cheats\\");
|
||||
TCHAR szAppHistoryPath[MAX_PATH] = _T("support\\");
|
||||
TCHAR szAppListsPath[MAX_PATH] = _T("support\\lists\\lst\\");
|
||||
TCHAR szAppDatListsPath[MAX_PATH] = _T("support\\lists\\dat\\");
|
||||
TCHAR szAppIpsPath[MAX_PATH] = _T("support\\ips\\");
|
||||
TCHAR szAppIconsPath[MAX_PATH] = _T("support\\icons\\");
|
||||
TCHAR szAppArchivesPath[MAX_PATH] = _T("support\\archives\\");
|
||||
TCHAR szAppHiscorePath[MAX_PATH] = _T("support\\hiscores\\");
|
||||
TCHAR szAppSamplesPath[MAX_PATH] = _T("support\\samples\\");
|
||||
TCHAR szAppBlendPath[MAX_PATH] = _T("support\\blend\\");
|
||||
|
||||
TCHAR szCheckIconsPath[MAX_PATH];
|
|
@ -2,15 +2,14 @@
|
|||
#ifdef _UNICODE
|
||||
//TODO: bah
|
||||
#include <wchar.h>
|
||||
#define __TEXT(q) L##q
|
||||
#define __TEXT(q) L##q
|
||||
|
||||
typedef wchar_t TCHAR;
|
||||
typedef wchar_t TCHAR;
|
||||
typedef wchar_t _TCHAR;
|
||||
|
||||
#else
|
||||
|
||||
|
||||
#define __TEXT(q) q
|
||||
#define __TEXT(q) q
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
typedef char TCHAR;
|
||||
|
@ -43,19 +42,18 @@ typedef char _TCHAR;
|
|||
#define _fgetts fgets
|
||||
#define _fputts fputs
|
||||
|
||||
#define _istspace isspace
|
||||
#define _istspace isspace
|
||||
|
||||
#define _tfopen fopen
|
||||
|
||||
#define _stricmp strcmp
|
||||
#define _strnicmp strncmp
|
||||
#define _stricmp strcmp
|
||||
#define _strnicmp strncmp
|
||||
|
||||
// FBA function, change this!
|
||||
#define dprintf printf
|
||||
|
||||
#define dprintf printf
|
||||
|
||||
#endif
|
||||
|
||||
#define _TEXT(x) __TEXT(x)
|
||||
#define _T(x) __TEXT(x)
|
||||
#define _TEXT(x) __TEXT(x)
|
||||
#define _T(x) __TEXT(x)
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ INT32 BurnStateSaveEmbed(FILE* fp, INT32 nOffset, INT32 bAll)
|
|||
return nDefLen;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef BUILD_WIN32
|
||||
int FileExists(const TCHAR *fileName)
|
||||
{
|
||||
DWORD dwAttrib = GetFileAttributes(fileName);
|
||||
|
@ -301,7 +301,7 @@ int FileExists(const TCHAR *fileName)
|
|||
// SaveState Undo - restores the last savestate backup file. Windows-only at the moment.
|
||||
INT32 BurnStateUNDO(TCHAR* szName)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#ifdef BUILD_WIN32
|
||||
/*
|
||||
Savestate Undo
|
||||
derp.fs.backup0 -> derp.fs
|
||||
|
@ -363,7 +363,7 @@ INT32 BurnStateSave(TCHAR* szName, INT32 bAll)
|
|||
derp.fs.backup1 -> derpfs.backup2
|
||||
derp.fs.backup3 -> derpfs.backup4
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
#ifdef BUILD_WIN32
|
||||
if (_tcsstr(szName, _T(" slot "))) {
|
||||
for (INT32 i=MAX_STATEBACKUPS;i>=0;i--) {
|
||||
TCHAR szBackupNameTo[1024] = _T("");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SDL_Sound module
|
||||
|
||||
#include "SDL.h"
|
||||
#include <SDL/SDL.h>
|
||||
#include "burner.h"
|
||||
#include "aud_dsp.h"
|
||||
#include <math.h>
|
||||
|
@ -151,18 +151,18 @@ static int SDLSoundInit()
|
|||
SDL_AudioSpec audiospec_req;
|
||||
int nSDLBufferSize;
|
||||
|
||||
//dprintf(_T("SDLSoundInit (%dHz)"), nAudSampleRate);
|
||||
dprintf(_T("SDLSoundInit (%dHz)\n"), nAudSampleRate[0]);
|
||||
|
||||
if (nAudSampleRate <= 0) {
|
||||
if (nAudSampleRate[0] <= 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
nSoundFps = nAppVirtualFps;
|
||||
nAudSegLen = (44010 * 100 + (nSoundFps >> 1)) / nSoundFps;
|
||||
nAudSegLen = (nAudSampleRate[0] * 100 + (nSoundFps >> 1)) / nSoundFps;
|
||||
nAudLoopLen = (nAudSegLen * nAudSegCount) << 2;
|
||||
for (nSDLBufferSize = 64; nSDLBufferSize < (nAudSegLen >> 1); nSDLBufferSize <<= 1) { }
|
||||
|
||||
audiospec_req.freq = 44010;
|
||||
audiospec_req.freq = nAudSampleRate[0];
|
||||
audiospec_req.format = AUDIO_S16;
|
||||
audiospec_req.channels = 2;
|
||||
audiospec_req.samples = nSDLBufferSize;
|
||||
|
@ -182,7 +182,6 @@ static int SDLSoundInit()
|
|||
return 1;
|
||||
}
|
||||
|
||||
nAudNextSound = SDLAudBuffer;
|
||||
nSDLPlayPos = 0;
|
||||
nSDLFillSeg = nAudSegCount - 1;
|
||||
|
||||
|
|
|
@ -0,0 +1,595 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// iso/cue/wav support
|
||||
/*-----------------------------------------------------------------------------
|
||||
Modified by: CaptainCPS-X
|
||||
Updates:
|
||||
(10/24/2011)
|
||||
- removed libmad and MP3 support
|
||||
- added my custom DirectSound library to add WAV support
|
||||
- removed most (if not all) references to MP3
|
||||
- modified a few other things as needed
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "burner.h"
|
||||
#include "cdsound.h"
|
||||
|
||||
#define MAXIMUM_NUMBER_TRACKS (100)
|
||||
|
||||
#define CD_FRAMES_MINUTE (60 * 75)
|
||||
#define CD_FRAMES_SECOND ( 75)
|
||||
#define CD_FRAMES_PREGAP ( 2 * 75)
|
||||
|
||||
struct isowavTRACK_DATA {
|
||||
char Control;
|
||||
char TrackNumber;
|
||||
char Address[4];
|
||||
TCHAR* Filename;
|
||||
};
|
||||
|
||||
struct isowavCDROM_TOC {
|
||||
char FirstTrack;
|
||||
char LastTrack;
|
||||
isowavTRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
|
||||
};
|
||||
|
||||
static isowavCDROM_TOC* isowavTOC;
|
||||
|
||||
static FILE* isowavFile = NULL;
|
||||
static int isowavTrack = 0;
|
||||
static int isowavLBA = 0;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static const char* isowavLBAToMSF(const int LBA)
|
||||
{
|
||||
static char address[4];
|
||||
|
||||
address[0] = 0;
|
||||
address[1] = LBA / CD_FRAMES_MINUTE;
|
||||
address[2] = LBA % CD_FRAMES_MINUTE / CD_FRAMES_SECOND;
|
||||
address[3] = LBA % CD_FRAMES_SECOND;
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
static int isowavMSFToLBA(const char* address)
|
||||
{
|
||||
int LBA;
|
||||
|
||||
LBA = address[3];
|
||||
LBA += address[2] * CD_FRAMES_SECOND;
|
||||
LBA += address[1] * CD_FRAMES_MINUTE;
|
||||
|
||||
return LBA;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static int isowavGetTrackSizes()
|
||||
{
|
||||
// determine the lenght of the .iso / .mp3 files to complete the TOC
|
||||
|
||||
FILE* h;
|
||||
|
||||
for (int i = isowavTOC->FirstTrack - 1; i < isowavTOC->LastTrack; i++) {
|
||||
|
||||
const char* address;
|
||||
|
||||
if (isowavTOC->TrackData[i].Control & 4) {
|
||||
|
||||
// data track
|
||||
|
||||
h = _tfopen(isowavTOC->TrackData[i].Filename, _T("rb"));
|
||||
if (h == NULL) return 1;
|
||||
|
||||
fseek(h, 0, SEEK_END);
|
||||
|
||||
address = isowavLBAToMSF((ftell(h) + 2047) / 2048 + isowavMSFToLBA(isowavTOC->TrackData[i].Address));
|
||||
|
||||
if(h) fclose(h);
|
||||
|
||||
} else {
|
||||
|
||||
// audio track
|
||||
|
||||
h = _tfopen(isowavTOC->TrackData[i].Filename, _T("rb"));
|
||||
if (h == NULL)return 1;
|
||||
|
||||
fseek(h, 0, SEEK_END);
|
||||
|
||||
address = isowavLBAToMSF(((ftell(h) + 2047) / 2048) + isowavMSFToLBA(isowavTOC->TrackData[i].Address));
|
||||
if(h) fclose(h);
|
||||
}
|
||||
|
||||
isowavTOC->TrackData[i + 1].Address[0] += 0; // always 0 [?]
|
||||
isowavTOC->TrackData[i + 1].Address[1] += address[1]; // M
|
||||
isowavTOC->TrackData[i + 1].Address[2] += address[2]; // S
|
||||
isowavTOC->TrackData[i + 1].Address[3] += address[3]; // F
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int isowavTestISO()
|
||||
{
|
||||
TCHAR fullname[MAX_PATH];
|
||||
TCHAR* filename;
|
||||
int length = 0;
|
||||
int offset = 0;
|
||||
int track = 2;
|
||||
FILE* h;
|
||||
|
||||
_tcscpy(fullname, CDEmuImage);
|
||||
length = _tcslen(fullname);
|
||||
|
||||
// assume CD-ROM mode1/2048 format
|
||||
|
||||
if (length <= 4 && (_tcscmp(_T(".iso"), fullname + length - 4) || _tcscmp(_T(".bin"), fullname + length - 4))) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// create a TOC with only the data track first
|
||||
|
||||
isowavTOC->FirstTrack = 1;
|
||||
isowavTOC->LastTrack = 1;
|
||||
|
||||
isowavTOC->TrackData[0].TrackNumber = 1;
|
||||
|
||||
isowavTOC->TrackData[0].Address[1] = 0;
|
||||
isowavTOC->TrackData[0].Address[2] = 2;
|
||||
isowavTOC->TrackData[0].Address[3] = 0;
|
||||
|
||||
isowavTOC->TrackData[0].Filename = (TCHAR*)malloc((length + 1) * sizeof(TCHAR));
|
||||
if (isowavTOC->TrackData[0].Filename == NULL) {
|
||||
return 1;
|
||||
}
|
||||
_tcscpy(isowavTOC->TrackData[0].Filename, fullname);
|
||||
|
||||
isowavTOC->TrackData[0].Control = 4;
|
||||
|
||||
// if the filename has a number in it, try to find .mp3 tracks
|
||||
|
||||
filename = ExtractFilename(fullname);
|
||||
offset = (filename - fullname) + length - 6;
|
||||
while (offset >= 0 && fullname[offset] != _T('0') && fullname[offset + 1] != _T('1')) {
|
||||
offset--;
|
||||
}
|
||||
if (offset < 0) {
|
||||
return isowavGetTrackSizes();
|
||||
}
|
||||
|
||||
_stprintf(fullname + length - 4, _T(".wav"));
|
||||
|
||||
while (1) {
|
||||
fullname[offset] = _T('0') + track / 10; fullname[offset + 1] = _T('0') + track % 10;
|
||||
|
||||
if ((h = _tfopen(fullname, _T("rb"))) == NULL) {
|
||||
break;
|
||||
}
|
||||
fclose(h);
|
||||
|
||||
isowavTOC->TrackData[track - 1].TrackNumber = track;
|
||||
|
||||
isowavTOC->TrackData[track - 1].Filename = (TCHAR*)malloc((length + 1) * sizeof(TCHAR));
|
||||
if (isowavTOC->TrackData[track - 1].Filename == NULL) {
|
||||
return 1;
|
||||
}
|
||||
_tcscpy(isowavTOC->TrackData[track - 1].Filename, fullname);
|
||||
|
||||
isowavTOC->LastTrack = track;
|
||||
|
||||
track++;
|
||||
}
|
||||
|
||||
return isowavGetTrackSizes();
|
||||
}
|
||||
|
||||
static int isowavParseCueFile()
|
||||
{
|
||||
TCHAR szLine[1024];
|
||||
TCHAR szFile[1024];
|
||||
TCHAR* s;
|
||||
TCHAR* t;
|
||||
FILE* h;
|
||||
int track = 0;
|
||||
int length;
|
||||
|
||||
isowavTOC->FirstTrack = 1;
|
||||
isowavTOC->LastTrack = 1;
|
||||
|
||||
isowavTOC->TrackData[0].Address[1] = 0;
|
||||
isowavTOC->TrackData[0].Address[2] = 2;
|
||||
isowavTOC->TrackData[0].Address[3] = 0;
|
||||
|
||||
h = _tfopen(CDEmuImage, _T("rt"));
|
||||
if (h == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
if (_fgetts(szLine, sizeof(szLine), h) == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
length = _tcslen(szLine);
|
||||
// get rid of the linefeed at the end
|
||||
while (length && (szLine[length - 1] == _T('\r') || szLine[length - 1] == _T('\n'))) {
|
||||
szLine[length - 1] = 0;
|
||||
length--;
|
||||
}
|
||||
|
||||
s = szLine;
|
||||
|
||||
// file info
|
||||
if ((t = LabelCheck(s, _T("FILE"))) != 0) {
|
||||
s = t;
|
||||
|
||||
TCHAR* szQuote;
|
||||
|
||||
// read filename
|
||||
QuoteRead(&szQuote, NULL, s);
|
||||
|
||||
_sntprintf(szFile, ExtractFilename(CDEmuImage) - CDEmuImage, _T("%s"), CDEmuImage);
|
||||
_sntprintf(szFile + (ExtractFilename(CDEmuImage) - CDEmuImage), 1024 - (ExtractFilename(CDEmuImage) - CDEmuImage), _T("/%s"), szQuote);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// track info
|
||||
if ((t = LabelCheck(s, _T("TRACK"))) != 0) {
|
||||
s = t;
|
||||
|
||||
// track number
|
||||
track = _tcstol(s, &t, 10);
|
||||
|
||||
if (track < 1 || track > MAXIMUM_NUMBER_TRACKS) {
|
||||
fclose(h);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (track < isowavTOC->FirstTrack) {
|
||||
isowavTOC->FirstTrack = track;
|
||||
}
|
||||
if (track > isowavTOC->LastTrack) {
|
||||
isowavTOC->LastTrack = track;
|
||||
}
|
||||
isowavTOC->TrackData[track - 1].TrackNumber = track;
|
||||
|
||||
isowavTOC->TrackData[track - 1].Filename = (TCHAR*)malloc((_tcslen(szFile) + 1) * sizeof(TCHAR));
|
||||
if (isowavTOC->TrackData[track - 1].Filename == NULL) {
|
||||
fclose(h);
|
||||
return 1;
|
||||
}
|
||||
_tcscpy(isowavTOC->TrackData[track - 1].Filename, szFile);
|
||||
|
||||
s = t;
|
||||
|
||||
// type of track
|
||||
|
||||
if ((t = LabelCheck(s, _T("MODE1/2048"))) != 0) {
|
||||
isowavTOC->TrackData[track - 1].Control = 4;
|
||||
|
||||
continue;
|
||||
}
|
||||
if ((t = LabelCheck(s, _T("AUDIO"))) != 0) {
|
||||
isowavTOC->TrackData[track - 1].Control = 0;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
fclose(h);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// pregap
|
||||
if ((t = LabelCheck(s, _T("PREGAP"))) != 0) {
|
||||
s = t;
|
||||
|
||||
int M, S, F;
|
||||
|
||||
// pregap M
|
||||
M = _tcstol(s, &t, 10);
|
||||
s = t + 1;
|
||||
// pregap S
|
||||
S = _tcstol(s, &t, 10);
|
||||
s = t + 1;
|
||||
// pregap F
|
||||
F = _tcstol(s, &t, 10);
|
||||
|
||||
if (M < 0 || M > 100 || S < 0 || S > 59 || F < 0 || F > 74) {
|
||||
fclose(h);
|
||||
return 1;
|
||||
}
|
||||
|
||||
isowavTOC->TrackData[track - 1].Address[1] = M;
|
||||
isowavTOC->TrackData[track - 1].Address[2] = S;
|
||||
isowavTOC->TrackData[track - 1].Address[3] = F;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(h);
|
||||
|
||||
return isowavGetTrackSizes();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static int isowavExit()
|
||||
{
|
||||
wav_exit();
|
||||
|
||||
if (isowavFile) {
|
||||
fclose(isowavFile);
|
||||
isowavFile = NULL;
|
||||
}
|
||||
|
||||
isowavTrack = 0;
|
||||
isowavLBA = 0;
|
||||
|
||||
if (isowavTOC) {
|
||||
for (int i = 0; i < MAXIMUM_NUMBER_TRACKS; i++) {
|
||||
free(isowavTOC->TrackData[i].Filename);
|
||||
}
|
||||
|
||||
free(isowavTOC);
|
||||
isowavTOC = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int isowavInit()
|
||||
{
|
||||
wav_exit();
|
||||
|
||||
isowavTOC = (isowavCDROM_TOC*)malloc(sizeof(isowavCDROM_TOC));
|
||||
if (isowavTOC == NULL) {
|
||||
return 1;
|
||||
}
|
||||
memset(isowavTOC, 0, sizeof(isowavCDROM_TOC));
|
||||
|
||||
TCHAR* filename = ExtractFilename(CDEmuImage);
|
||||
|
||||
if (_tcslen(filename) < 4) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (_tcscmp(_T(".cue"), filename + _tcslen(filename) - 4) == 0) {
|
||||
if (isowavParseCueFile()) {
|
||||
dprintf(_T("*** Couldn't parse .cue file\n"));
|
||||
isowavExit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (isowavTestISO()) {
|
||||
dprintf(_T("*** Couldn't find .iso / .bin file\n"));
|
||||
isowavExit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
dprintf(_T(" CD image TOC read\n"));
|
||||
|
||||
for (int i = isowavTOC->FirstTrack - 1; i < isowavTOC->LastTrack; i++) {
|
||||
dprintf(_T(" track %2i start %02i:%02i:%02i control 0x%02X %s\n"), isowavTOC->TrackData[i].TrackNumber, isowavTOC->TrackData[i].Address[1], isowavTOC->TrackData[i].Address[2], isowavTOC->TrackData[i].Address[3], isowavTOC->TrackData[i].Control, isowavTOC->TrackData[i].Filename);
|
||||
}
|
||||
dprintf(_T(" total running time %02i:%02i:%02i\n"), isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[1], isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[2], isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[3]);
|
||||
|
||||
CDEmuStatus = idle;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
TCHAR* GetIsoPath()
|
||||
{
|
||||
if(isowavTOC) {
|
||||
return isowavTOC->TrackData[0].Filename;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int isowavStop()
|
||||
{
|
||||
wav_stop();
|
||||
|
||||
if (isowavFile) {
|
||||
fclose(isowavFile);
|
||||
isowavFile = NULL;
|
||||
}
|
||||
CDEmuStatus = idle;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int isowavPlayLBA(int LBA)
|
||||
{
|
||||
isowavLBA = LBA;
|
||||
|
||||
for (isowavTrack = isowavTOC->FirstTrack - 1; isowavTrack < isowavTOC->LastTrack; isowavTrack++) {
|
||||
if (isowavLBA < isowavMSFToLBA(isowavTOC->TrackData[isowavTrack + 1].Address)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isowavTrack >= isowavTOC->LastTrack) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
bprintf(PRINT_IMPORTANT, _T(" playing track %2i - %s\n"), isowavTrack + 1, isowavTOC->TrackData[isowavTrack].Filename);
|
||||
|
||||
isowavFile = _tfopen(isowavTOC->TrackData[isowavTrack].Filename, _T("rb"));
|
||||
if (isowavFile == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( strstr(isowavTOC->TrackData[isowavTrack].Filename, _T(".wav")) || strstr(isowavTOC->TrackData[isowavTrack].Filename, _T(".WAV"))) {
|
||||
// is a wav, no need to keep this file pointer
|
||||
if (isowavFile) {
|
||||
fclose(isowavFile);
|
||||
isowavFile = NULL;
|
||||
}
|
||||
|
||||
if(wav_open(isowavTOC->TrackData[isowavTrack].Filename)) {
|
||||
wav_play();
|
||||
} else {
|
||||
// error creating the WAV stream
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
//dprintf(_T("*** WAV: wBitsPerSample: %d \n"), wav->g_pStreamingSound->m_pWaveFile->m_pwfx->wBitsPerSample);
|
||||
//dprintf(_T("*** WAV: nAvgBytesPerSec: %d \n"), wav->g_pStreamingSound->m_pWaveFile->m_pwfx->nAvgBytesPerSec);
|
||||
//dprintf(_T("*** WAV: m_dwSize: %d \n"), wav->g_pStreamingSound->m_pWaveFile->m_dwSize);
|
||||
//dprintf(_T("*** WAV: nBlockAlign: %d \n"), wav->g_pStreamingSound->m_pWaveFile->m_pwfx->nBlockAlign);
|
||||
|
||||
isowavLBA = isowavMSFToLBA(isowavTOC->TrackData[isowavTrack].Address);
|
||||
CDEmuStatus = playing;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int isowavPlay(unsigned char M, unsigned char S, unsigned char F)
|
||||
{
|
||||
const char address[] = { 0, M, S, F };
|
||||
|
||||
return isowavPlayLBA(isowavMSFToLBA(address));
|
||||
}
|
||||
|
||||
static int isowavLoadSector(int LBA, char* pBuffer)
|
||||
{
|
||||
LBA += CD_FRAMES_PREGAP;
|
||||
|
||||
if (LBA != isowavLBA) {
|
||||
|
||||
int track;
|
||||
|
||||
for (track = isowavTOC->FirstTrack - 1; track < isowavTOC->LastTrack; track++) {
|
||||
if (LBA < isowavMSFToLBA(isowavTOC->TrackData[track + 1].Address)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isowavFile == NULL || track != isowavTrack) {
|
||||
isowavStop();
|
||||
|
||||
isowavTrack = track;
|
||||
|
||||
bprintf(PRINT_IMPORTANT, _T(" reading track %2i - %s\n"), isowavTrack + 1, isowavTOC->TrackData[isowavTrack].Filename);
|
||||
|
||||
isowavFile = _tfopen(isowavTOC->TrackData[isowavTrack].Filename, _T("rb"));
|
||||
if (isowavFile == NULL) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (fseek(isowavFile, (LBA - isowavMSFToLBA(isowavTOC->TrackData[isowavTrack].Address)) * 2048, SEEK_SET)) {
|
||||
dprintf(_T("*** couldn't seek\n"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
isowavLBA = (ftell(isowavFile) + 2047) / 2048;
|
||||
|
||||
CDEmuStatus = reading;
|
||||
}
|
||||
|
||||
if (fread(pBuffer, 1, 2048, isowavFile) <= 0) {
|
||||
dprintf(_T("*** couldn't read from file\n"));
|
||||
|
||||
isowavStop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
isowavLBA = isowavMSFToLBA(isowavTOC->TrackData[isowavTrack].Address) + (ftell(isowavFile) + 2047) / 2048;
|
||||
|
||||
return isowavLBA - CD_FRAMES_PREGAP;
|
||||
}
|
||||
|
||||
static unsigned char* isowavReadTOC(int track)
|
||||
{
|
||||
static unsigned char TOCEntry[4];
|
||||
|
||||
if (track == -1) {
|
||||
TOCEntry[0] = isowavTOC->FirstTrack - 1;
|
||||
TOCEntry[1] = isowavTOC->LastTrack;
|
||||
TOCEntry[2] = 0;
|
||||
TOCEntry[3] = 0;
|
||||
|
||||
return TOCEntry;
|
||||
}
|
||||
if (track == -2) {
|
||||
TOCEntry[0] = isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[1];
|
||||
TOCEntry[1] = isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[2];
|
||||
TOCEntry[2] = isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[3];
|
||||
|
||||
TOCEntry[3] = 0;
|
||||
|
||||
return TOCEntry;
|
||||
}
|
||||
|
||||
if (track >= isowavTOC->FirstTrack - 1 && track <= isowavTOC->LastTrack) {
|
||||
TOCEntry[0] = isowavTOC->TrackData[track - 1].Address[1];
|
||||
TOCEntry[1] = isowavTOC->TrackData[track - 1].Address[2];
|
||||
TOCEntry[2] = isowavTOC->TrackData[track - 1].Address[3];
|
||||
TOCEntry[3] = isowavTOC->TrackData[track - 1].Control;
|
||||
}
|
||||
|
||||
return TOCEntry;
|
||||
}
|
||||
|
||||
static unsigned char* isowavReadQChannel()
|
||||
{
|
||||
static unsigned char QChannelData[8];
|
||||
|
||||
switch (CDEmuStatus) {
|
||||
case reading:
|
||||
case playing: {
|
||||
const char* AddressAbs = isowavLBAToMSF(isowavLBA);
|
||||
const char* AddressRel = isowavLBAToMSF(isowavLBA - isowavMSFToLBA(isowavTOC->TrackData[isowavTrack].Address));
|
||||
|
||||
QChannelData[0] = isowavTOC->TrackData[isowavTrack].TrackNumber;
|
||||
|
||||
QChannelData[1] = AddressAbs[1];
|
||||
QChannelData[2] = AddressAbs[2];
|
||||
QChannelData[3] = AddressAbs[3];
|
||||
|
||||
QChannelData[4] = AddressRel[1];
|
||||
QChannelData[5] = AddressRel[2];
|
||||
QChannelData[6] = AddressRel[3];
|
||||
|
||||
QChannelData[7] = isowavTOC->TrackData[isowavTrack].Control;
|
||||
|
||||
break;
|
||||
}
|
||||
case paused: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
memset(QChannelData, 0, sizeof(QChannelData));
|
||||
}
|
||||
}
|
||||
|
||||
return QChannelData;
|
||||
}
|
||||
|
||||
static int isowavGetSoundBuffer(short* /*buffer*/, int /*samples*/)
|
||||
{
|
||||
// ---------------------------------------------------------------------
|
||||
// TODO:
|
||||
// Port the old 'isomp3GetSoundBuffer()' function from 'cd_isomp3.cpp'
|
||||
// to use WAVE stream data, porting that function will fix the
|
||||
// 00:00 progress status on the main NeoGeo CD BIOS menu.
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int isowavGetSettings(InterfaceInfo* /*pInfo*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct CDEmuDo isowavDo = { isowavExit, isowavInit, isowavStop, isowavPlay, isowavLoadSector, isowavReadTOC, isowavReadQChannel, isowavGetSoundBuffer, isowavGetSettings, _T("cue/iso/wav CD emulation") };
|
|
@ -0,0 +1,22 @@
|
|||
#include "burner.h"
|
||||
#include "cd_interface.h"
|
||||
|
||||
void wav_exit()
|
||||
{
|
||||
}
|
||||
|
||||
int wav_open(TCHAR* szFile)
|
||||
{
|
||||
}
|
||||
|
||||
void wav_stop()
|
||||
{
|
||||
}
|
||||
|
||||
void wav_play()
|
||||
{
|
||||
}
|
||||
|
||||
void wav_pause(bool bResume)
|
||||
{
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef _WavClass_H_
|
||||
#define _WavClass_H_
|
||||
|
||||
void wav_exit();
|
||||
int wav_open(TCHAR* szFile);
|
||||
void wav_stop();
|
||||
void wav_play();
|
||||
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
// Module for input using SDL
|
||||
#include <SDL.h>
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#include "burner.h"
|
||||
#include "inp_sdl_keys.h"
|
||||
|
@ -24,7 +24,8 @@ static int SDLinpJoystickInit(int i)
|
|||
static int SDLinpKeyboardInit()
|
||||
{
|
||||
for (int i = 0; i < 512; i++) {
|
||||
FBKtoSDL[SDLtoFBK[i]] = i;
|
||||
if (SDLtoFBK[i] > 0)
|
||||
FBKtoSDL[SDLtoFBK[i]] = i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#ifdef BUILD_SDL
|
||||
|
||||
static int SDLtoFBK[512] = {
|
||||
0,
|
||||
-1,
|
||||
|
@ -324,5 +322,3 @@ static int SDLtoFBK[512] = {
|
|||
-1,
|
||||
-1,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -45,12 +45,15 @@
|
|||
SECTION .text ALIGN = 32
|
||||
GLOBAL _superscale_line
|
||||
GLOBAL _superscale_line_75
|
||||
GLOBAL superscale_line
|
||||
GLOBAL superscale_line_75
|
||||
|
||||
%macro ALIGN32 0
|
||||
times ($$-$)&31 nop
|
||||
%endmacro
|
||||
|
||||
_superscale_line:
|
||||
superscale_line:
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
push eax
|
||||
|
@ -122,6 +125,7 @@ iloop:
|
|||
ALIGN32
|
||||
|
||||
_superscale_line_75: ;do a 75% reduction on the final pixel colour
|
||||
superscale_line_75: ;do a 75% reduction on the final pixel colour
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
push eax
|
||||
|
|
|
@ -10,26 +10,26 @@
|
|||
#ifdef frame_timer
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
|
||||
static int nInitedSubsytems = 0;
|
||||
|
||||
static int nGamesWidth = 0, nGamesHeight = 0; // screen size
|
||||
static int nGamesWidth = 0, nGamesHeight = 0; // screen size
|
||||
|
||||
static SDL_Surface *screen=NULL;
|
||||
static unsigned char *texture = NULL;
|
||||
static unsigned char *gamescreen=NULL;
|
||||
|
||||
static SDL_Surface* screen=NULL;
|
||||
static unsigned char* texture = NULL;
|
||||
static unsigned char* gamescreen=NULL;
|
||||
|
||||
static GLint color_type = GL_RGB;
|
||||
static GLint texture_type= GL_UNSIGNED_BYTE;
|
||||
|
||||
static int nTextureWidth=512;
|
||||
static int nTextureHeight=512;
|
||||
|
||||
static GLint texture_type = GL_UNSIGNED_BYTE;
|
||||
|
||||
static int nTextureWidth = 512;
|
||||
static int nTextureHeight = 512;
|
||||
|
||||
static int nSize;
|
||||
static int nUseBlitter;
|
||||
|
||||
static int nRotateGame = 0;
|
||||
unsigned int g_Texture[1];
|
||||
static bool bFlipped = false;
|
||||
|
||||
static int PrimClear()
|
||||
{
|
||||
|
@ -39,7 +39,6 @@ static int PrimClear()
|
|||
// Create a secondary DD surface for the screen
|
||||
static int BlitFXMakeSurf()
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -56,37 +55,38 @@ static int BlitFXExit()
|
|||
static int GetTextureSize(int Size)
|
||||
{
|
||||
int nTextureSize = 128;
|
||||
|
||||
while (nTextureSize < Size) {
|
||||
nTextureSize <<= 1;
|
||||
}
|
||||
|
||||
return nTextureSize;
|
||||
}
|
||||
|
||||
static int BlitFXInit()
|
||||
{
|
||||
int nMemLen = 0;
|
||||
|
||||
nVidImageWidth = nGamesWidth;
|
||||
nVidImageHeight = nGamesHeight;
|
||||
|
||||
nVidImageDepth = bDrvOkay ? 15 : 32;
|
||||
nVidImageDepth = bDrvOkay ? 16 : 32;
|
||||
nVidImageBPP = (nVidImageDepth + 7) >> 3;
|
||||
nBurnBpp = nVidImageBPP;
|
||||
SetBurnHighCol(nVidImageDepth);
|
||||
|
||||
int nMemLen = 0;
|
||||
if (!nRotateGame)
|
||||
{
|
||||
if (!nRotateGame) {
|
||||
nVidImagePitch = nVidImageWidth * nVidImageBPP;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
nVidImagePitch = nVidImageHeight * nVidImageBPP;
|
||||
}
|
||||
nMemLen = (nVidImageHeight) * nVidImagePitch;
|
||||
gamescreen=(unsigned char*)malloc(nMemLen);
|
||||
nBurnPitch=nVidImagePitch;
|
||||
|
||||
texture = (unsigned char*)malloc(nTextureWidth*nTextureHeight*nVidImageBPP);
|
||||
|
||||
nMemLen = nVidImageHeight * nVidImagePitch;
|
||||
nBurnPitch = nVidImagePitch;
|
||||
|
||||
texture = (unsigned char *)malloc(nTextureWidth * nTextureHeight * nVidImageBPP);
|
||||
|
||||
gamescreen = (unsigned char *)malloc(nMemLen);
|
||||
if (gamescreen) {
|
||||
memset(gamescreen, 0, nMemLen);
|
||||
pVidImage = gamescreen + nVidImagePitch;
|
||||
|
@ -101,11 +101,12 @@ static int BlitFXInit()
|
|||
|
||||
static int Exit()
|
||||
{
|
||||
free(gamescreen);
|
||||
free(texture);
|
||||
BlitFXExit();
|
||||
|
||||
if (!(nInitedSubsytems & SDL_INIT_VIDEO)) {
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
}
|
||||
|
||||
nInitedSubsytems = 0;
|
||||
|
||||
return 0;
|
||||
|
@ -113,46 +114,45 @@ static int Exit()
|
|||
|
||||
void init_gl()
|
||||
{
|
||||
const unsigned char * glVersion;
|
||||
int isGL12=GL_FALSE;
|
||||
const unsigned char *glVersion;
|
||||
int isGL12 = GL_FALSE;
|
||||
|
||||
printf("opengl config\n");
|
||||
|
||||
if ((BurnDrvGetFlags() & BDF_16BIT_ONLY)||(nVidImageBPP!=3))
|
||||
{
|
||||
texture_type= GL_UNSIGNED_SHORT_5_6_5_REV;
|
||||
}
|
||||
else
|
||||
{
|
||||
texture_type=GL_UNSIGNED_BYTE;
|
||||
if ((BurnDrvGetFlags() & BDF_16BIT_ONLY) || (nVidImageBPP != 3)) {
|
||||
texture_type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
} else {
|
||||
texture_type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
|
||||
glShadeModel (GL_FLAT);
|
||||
glDisable (GL_POLYGON_SMOOTH);
|
||||
glDisable (GL_LINE_SMOOTH);
|
||||
glDisable (GL_POINT_SMOOTH);
|
||||
glDisable(GL_BLEND);
|
||||
glShadeModel(GL_FLAT);
|
||||
glDisable(GL_POLYGON_SMOOTH);
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
glDisable(GL_POINT_SMOOTH);
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, nVidImageBPP, nTextureWidth, nTextureHeight, 0,GL_RGB, texture_type, texture);
|
||||
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, nVidImageBPP, nTextureWidth, nTextureHeight,
|
||||
0, GL_RGB, texture_type, texture);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
if (!nRotateGame)
|
||||
{
|
||||
glLoadIdentity();
|
||||
|
||||
if (!nRotateGame) {
|
||||
glRotatef(0.0, 0.0, 0.0, 1.0);
|
||||
glOrtho(0, nGamesWidth, nGamesHeight, 0, -1,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
glRotatef(90.0, 0.0, 0.0, 1.0);
|
||||
glOrtho(0, nGamesHeight, nGamesWidth, 0, -1,5);
|
||||
glOrtho(0, nGamesWidth, nGamesHeight, 0, -1, 1);
|
||||
} else {
|
||||
glRotatef((bFlipped ? -90.0 : 90.0), 0.0, 0.0, 1.0);
|
||||
glOrtho(0, nGamesHeight, nGamesWidth, 0, -1, 5);
|
||||
}
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
printf("opengl config done . . . \n");
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ int VidSScaleImage(RECT* pRect)
|
|||
int nWidth = pRect->right - pRect->left;
|
||||
int nHeight = pRect->bottom - pRect->top;
|
||||
|
||||
if (bVidFullStretch) { // Arbitrary stretch
|
||||
if (bVidFullStretch) { // Arbitrary stretch
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -176,20 +176,24 @@ int VidSScaleImage(RECT* pRect)
|
|||
}
|
||||
}
|
||||
|
||||
nScrnWidth =nGameAspectX;
|
||||
nScrnWidth = nGameAspectX;
|
||||
nScrnHeight = nGameAspectY;
|
||||
|
||||
int nWidthScratch;
|
||||
nWidthScratch = nHeight * nVidScrnAspectY * nGameAspectX * nScrnWidth / (nScrnHeight * nVidScrnAspectX * nGameAspectY);
|
||||
if (nWidthScratch > nWidth) { // The image is too wide
|
||||
if (nGamesWidth < nGamesHeight) { // Vertical games
|
||||
nHeight = nWidth * nVidScrnAspectY * nGameAspectY * nScrnWidth / (nScrnHeight * nVidScrnAspectX * nGameAspectX);
|
||||
} else { // Horizontal games
|
||||
nHeight = nWidth * nVidScrnAspectX * nGameAspectY * nScrnHeight / (nScrnWidth * nVidScrnAspectY * nGameAspectX);
|
||||
}
|
||||
} else {
|
||||
nWidth = nWidthScratch;
|
||||
|
||||
int nWidthScratch = nHeight * nVidScrnAspectY * nGameAspectX * nScrnWidth /
|
||||
(nScrnHeight * nVidScrnAspectX * nGameAspectY);
|
||||
|
||||
if (nWidthScratch > nWidth) { // The image is too wide
|
||||
if (nGamesWidth < nGamesHeight) { // Vertical games
|
||||
nHeight = nWidth * nVidScrnAspectY * nGameAspectY * nScrnWidth /
|
||||
(nScrnHeight * nVidScrnAspectX * nGameAspectX);
|
||||
} else { // Horizontal games
|
||||
nHeight = nWidth * nVidScrnAspectX * nGameAspectY * nScrnHeight /
|
||||
(nScrnWidth * nVidScrnAspectY * nGameAspectX);
|
||||
}
|
||||
} else {
|
||||
nWidth = nWidthScratch;
|
||||
}
|
||||
|
||||
pRect->left = (pRect->right + pRect->left) / 2;
|
||||
pRect->left -= nWidth / 2;
|
||||
pRect->right = pRect->left + nWidth;
|
||||
|
@ -208,165 +212,152 @@ static int Init()
|
|||
if (!(nInitedSubsytems & SDL_INIT_VIDEO)) {
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
}
|
||||
nGamesWidth = nVidImageWidth;
|
||||
|
||||
nGamesWidth = nVidImageWidth;
|
||||
nGamesHeight = nVidImageHeight;
|
||||
|
||||
nRotateGame = 0;
|
||||
if (bDrvOkay)
|
||||
{
|
||||
|
||||
if (bDrvOkay) {
|
||||
// Get the game screen size
|
||||
BurnDrvGetVisibleSize(&nGamesWidth, &nGamesHeight);
|
||||
|
||||
if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL)
|
||||
{
|
||||
if (nVidRotationAdjust & 1)
|
||||
{
|
||||
int n = nGamesWidth;
|
||||
nGamesWidth = nGamesHeight;
|
||||
nGamesHeight = n;
|
||||
nRotateGame |= (nVidRotationAdjust & 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
nRotateGame |= 1;
|
||||
}
|
||||
if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
|
||||
printf("Vertical\n");
|
||||
nRotateGame = 1;
|
||||
}
|
||||
|
||||
if (BurnDrvGetFlags() & BDF_ORIENTATION_FLIPPED)
|
||||
{
|
||||
nRotateGame ^= 2;
|
||||
}
|
||||
if (BurnDrvGetFlags() & BDF_ORIENTATION_FLIPPED) {
|
||||
printf("Flipped\n");
|
||||
bFlipped = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!nRotateGame)
|
||||
{
|
||||
nTextureWidth=GetTextureSize(nGamesWidth);
|
||||
nTextureHeight=GetTextureSize(nGamesHeight);
|
||||
}else
|
||||
{
|
||||
nTextureWidth=GetTextureSize(nGamesHeight);
|
||||
nTextureHeight=GetTextureSize(nGamesWidth);
|
||||
|
||||
if (!nRotateGame) {
|
||||
nTextureWidth = GetTextureSize(nGamesWidth);
|
||||
nTextureHeight = GetTextureSize(nGamesHeight);
|
||||
} else {
|
||||
nTextureWidth = GetTextureSize(nGamesHeight);
|
||||
nTextureHeight = GetTextureSize(nGamesWidth);
|
||||
}
|
||||
|
||||
nSize = 2;
|
||||
bVidScanlines = 0;
|
||||
|
||||
RECT test_rect;
|
||||
test_rect.left=0;
|
||||
test_rect.right= nGamesWidth;
|
||||
test_rect.top=0;
|
||||
test_rect.bottom=nGamesHeight;
|
||||
printf("correctx before %d, %d\n",test_rect.right,test_rect.bottom );
|
||||
test_rect.left = 0;
|
||||
test_rect.right = nGamesWidth;
|
||||
test_rect.top = 0;
|
||||
test_rect.bottom = nGamesHeight;
|
||||
|
||||
printf("correctx before %d, %d\n", test_rect.right, test_rect.bottom);
|
||||
VidSScaleImage(&test_rect);
|
||||
printf("correctx after %d, %d\n",test_rect.right,test_rect.bottom );
|
||||
screen=SDL_SetVideoMode(test_rect.right * nSize, test_rect.bottom*nSize,32 , SDL_OPENGL);
|
||||
SDL_WM_SetCaption("FB Alpha",NULL);
|
||||
printf("correctx after %d, %d\n", test_rect.right, test_rect.bottom);
|
||||
|
||||
screen = SDL_SetVideoMode(test_rect.right * nSize,
|
||||
test_rect.bottom * nSize, 32, SDL_OPENGL);
|
||||
SDL_WM_SetCaption("FB Alpha", NULL);
|
||||
|
||||
// Initialize the buffer surfaces
|
||||
BlitFXInit();
|
||||
//Init opengl
|
||||
|
||||
// Init opengl
|
||||
init_gl();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Run one frame and render the screen
|
||||
static int Frame(bool bRedraw) // bRedraw = 0
|
||||
static int Frame(bool bRedraw) // bRedraw = 0
|
||||
{
|
||||
if (pVidImage == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (bDrvOkay)
|
||||
{
|
||||
if (bRedraw)
|
||||
{ // Redraw current frame
|
||||
if (BurnDrvRedraw())
|
||||
{
|
||||
BurnDrvFrame(); // No redraw function provided, advance one frame
|
||||
if (bDrvOkay) {
|
||||
if (bRedraw) { // Redraw current frame
|
||||
if (BurnDrvRedraw()) {
|
||||
BurnDrvFrame(); // No redraw function provided, advance one frame
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BurnDrvFrame(); // Run one frame and draw the screen
|
||||
} else {
|
||||
BurnDrvFrame(); // Run one frame and draw the screen
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
typedef unsigned char byte;
|
||||
|
||||
void SurfToTex()
|
||||
static void SurfToTex()
|
||||
{
|
||||
unsigned char* Surf = (unsigned char*)gamescreen;
|
||||
int nPitch = nVidImagePitch;
|
||||
//printf("nvidImagePitch %d\n",nVidImagePitch);
|
||||
|
||||
unsigned char* VidSurf = (unsigned char*)texture;
|
||||
int nVidPitch = nTextureWidth*nVidImageBPP;
|
||||
|
||||
unsigned char *pd, *ps;
|
||||
|
||||
int nHeight = nGamesHeight;
|
||||
pd = VidSurf; ps = Surf;
|
||||
for (int y = 0; y < nHeight; y++, pd += nVidPitch, ps += nPitch)
|
||||
{
|
||||
memcpy(pd, ps, nPitch);
|
||||
int nVidPitch = nTextureWidth * nVidImageBPP;
|
||||
|
||||
unsigned char *ps = (unsigned char *)gamescreen;
|
||||
unsigned char *pd = (unsigned char *)texture;
|
||||
|
||||
for (int y = nGamesHeight; y--;) {
|
||||
memcpy(pd, ps, nVidImagePitch);
|
||||
pd += nVidPitch;
|
||||
ps += nVidImagePitch;
|
||||
}
|
||||
glTexImage2D(GL_TEXTURE_2D, 0,3, nTextureWidth, nTextureHeight, 0, GL_RGB, texture_type, texture);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, 3, nTextureWidth, nTextureHeight, 0,
|
||||
GL_RGB, texture_type, texture);
|
||||
}
|
||||
|
||||
void TexToQuad()
|
||||
static void TexToQuad()
|
||||
{
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0,0);
|
||||
glVertex2i(0,0);
|
||||
glTexCoord2f(0,1);
|
||||
glVertex2i(0,nTextureHeight);
|
||||
glTexCoord2f(1,1);
|
||||
glVertex2i(nTextureWidth,nTextureHeight);
|
||||
glTexCoord2f(1,0);
|
||||
glVertex2i(nTextureWidth,0);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 0);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, nTextureHeight);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(nTextureWidth, nTextureHeight);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(nTextureWidth, 0);
|
||||
glEnd();
|
||||
glFinish();
|
||||
}
|
||||
|
||||
|
||||
// Paint the BlitFX surface onto the primary surface
|
||||
static int Paint(int bValidate)
|
||||
{
|
||||
#ifdef frame_timer
|
||||
timeval start , end;
|
||||
time_t sec;
|
||||
suseconds_t usec;
|
||||
gettimeofday(&start,NULL);
|
||||
timeval start, end;
|
||||
time_t sec;
|
||||
suseconds_t usec;
|
||||
gettimeofday(&start, NULL);
|
||||
#endif
|
||||
SurfToTex();
|
||||
TexToQuad();
|
||||
SDL_GL_SwapBuffers();
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
#ifdef frame_timer
|
||||
gettimeofday(&end,NULL);
|
||||
sec = end.tv_sec - start.tv_sec;
|
||||
usec = end.tv_usec - start.tv_usec;
|
||||
if(usec < 0){
|
||||
usec += 1000000;
|
||||
sec--;
|
||||
}
|
||||
gettimeofday(&end, NULL);
|
||||
sec = end.tv_sec - start.tv_sec;
|
||||
usec = end.tv_usec - start.tv_usec;
|
||||
if (usec < 0) {
|
||||
usec += 1000000;
|
||||
sec--;
|
||||
}
|
||||
printf("Elapsed time : %ld.%ld\n", sec, usec);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidScale(RECT* , int, int)
|
||||
static int vidScale(RECT *, int, int)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int GetSettings(InterfaceInfo* pInfo)
|
||||
static int GetSettings(InterfaceInfo *pInfo)
|
||||
{
|
||||
TCHAR szString[MAX_PATH] = _T("");
|
||||
|
||||
_sntprintf(szString, MAX_PATH, _T("Prescaling using %s (%i× zoom)"), VidSoftFXGetEffect(nUseBlitter), nSize);
|
||||
_sntprintf(szString, MAX_PATH, _T("Prescaling using %s (%i× zoom)"),
|
||||
VidSoftFXGetEffect(nUseBlitter), nSize);
|
||||
IntInfoAddStringModule(pInfo, szString);
|
||||
|
||||
if (nRotateGame) {
|
||||
|
@ -378,4 +369,3 @@ static int GetSettings(InterfaceInfo* pInfo)
|
|||
|
||||
// The Video Output plugin:
|
||||
struct VidOut VidOutSDLOpenGL = { Init, Exit, Frame, Paint, vidScale, GetSettings, _T("SDL OpenGL Video output") };
|
||||
|
||||
|
|
Loading…
Reference in New Issue