gpgx waterbox: get sega cd working
This commit is contained in:
parent
8136aa0f03
commit
b06908e5d4
|
@ -37,10 +37,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
LagCount = reader.ReadInt32();
|
||||
IsLagFrame = reader.ReadBoolean();
|
||||
// any managed pointers that we sent to the core need to be resent now!
|
||||
// TODO: sega cd won't work until we fix that!
|
||||
Core.gpgx_set_input_callback(InputCallback);
|
||||
RefreshMemCallbacks();
|
||||
|
||||
Core.gpgx_set_cdd_callback(cd_callback_handle);
|
||||
UpdateVideo();
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
|
||||
try
|
||||
{
|
||||
Elf = new ElfRunner(Path.Combine(comm.CoreFileProvider.DllPath(), "gpgx.elf"), 65536, 36 * 1024 * 1024, 4 * 1024 * 1024);
|
||||
Elf = new ElfRunner(Path.Combine(comm.CoreFileProvider.DllPath(), "gpgx.elf"), 256 * 1024, 36 * 1024 * 1024, 4 * 1024 * 1024);
|
||||
|
||||
Core = BizInvoker.GetInvoker<LibGPGX>(Elf);
|
||||
|
||||
|
@ -81,7 +81,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
|
||||
this.romfile = rom;
|
||||
this.CD = CD;
|
||||
if (CD != null)
|
||||
{
|
||||
this.DiscSectorReader = new DiscSystem.DiscSectorReader(CD);
|
||||
cd_callback_handle = new LibGPGX.cd_read_cb(CDRead);
|
||||
Core.gpgx_set_cdd_callback(cd_callback_handle);
|
||||
}
|
||||
|
||||
LibGPGX.INPUT_SYSTEM system_a = LibGPGX.INPUT_SYSTEM.SYSTEM_NONE;
|
||||
LibGPGX.INPUT_SYSTEM system_b = LibGPGX.INPUT_SYSTEM.SYSTEM_NONE;
|
||||
|
@ -304,8 +309,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
LibGPGX.CDData ret = new LibGPGX.CDData();
|
||||
int size = Marshal.SizeOf(ret);
|
||||
|
||||
ret.readcallback = cd_callback_handle = new LibGPGX.cd_read_cb(CDRead);
|
||||
|
||||
var ses = CD.Session1;
|
||||
int ntrack = ses.InformationTrackCount;
|
||||
|
||||
|
|
|
@ -274,9 +274,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
public int last;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = CD_MAX_TRACKS)]
|
||||
public readonly CDTrack[] tracks = new CDTrack[CD_MAX_TRACKS];
|
||||
public cd_read_cb readcallback;
|
||||
}
|
||||
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void gpgx_set_cdd_callback(cd_read_cb cddcb);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct VDPNameTable
|
||||
{
|
||||
|
|
|
@ -13,6 +13,8 @@ extern ECL_ENTRY void (*biz_writecb)(unsigned addr);
|
|||
extern CDCallback biz_cdcallback;
|
||||
extern unsigned biz_lastpc;
|
||||
|
||||
extern ECL_ENTRY void (*cdd_readcallback)(int lba, void *dest, int audio);
|
||||
|
||||
enum eCDLog_AddrType
|
||||
{
|
||||
eCDLog_AddrType_MDCART, eCDLog_AddrType_RAM68k, eCDLog_AddrType_RAMZ80, eCDLog_AddrType_SRAM,
|
||||
|
|
|
@ -57,12 +57,12 @@ static uint8_t brm_format[0x40] =
|
|||
0x52,0x41,0x4d,0x5f,0x43,0x41,0x52,0x54,0x52,0x49,0x44,0x47,0x45,0x5f,0x5f,0x5f
|
||||
};
|
||||
|
||||
ECL_ENTRY void (*biz_execcb)(unsigned addr) = NULL;
|
||||
ECL_ENTRY void (*biz_readcb)(unsigned addr) = NULL;
|
||||
ECL_ENTRY void (*biz_writecb)(unsigned addr) = NULL;
|
||||
ECL_ENTRY void (*biz_execcb)(unsigned addr);
|
||||
ECL_ENTRY void (*biz_readcb)(unsigned addr);
|
||||
ECL_ENTRY void (*biz_writecb)(unsigned addr);
|
||||
CDCallback biz_cdcallback = NULL;
|
||||
unsigned biz_lastpc = 0;
|
||||
|
||||
ECL_ENTRY void (*cdd_readcallback)(int lba, void *dest, int audio);
|
||||
uint8 *tempsram;
|
||||
|
||||
static void update_viewport(void)
|
||||
|
@ -123,44 +123,6 @@ GPGX_EX void gpgx_get_fps(int *num, int *den)
|
|||
}
|
||||
}
|
||||
|
||||
GPGX_EX int gpgx_state_max_size(void)
|
||||
{
|
||||
// original state size, plus 64K sram or 16K ebram, plus 8K ibram or seeprom control structures
|
||||
return STATE_SIZE + (64 + 8) * 1024;
|
||||
}
|
||||
|
||||
GPGX_EX int gpgx_state_size(void *dest, int size)
|
||||
{
|
||||
int actual = 0;
|
||||
if (size < gpgx_state_max_size())
|
||||
return -1;
|
||||
|
||||
actual = state_save((unsigned char*) dest);
|
||||
if (actual > size)
|
||||
// fixme!
|
||||
return -1;
|
||||
return actual;
|
||||
}
|
||||
|
||||
GPGX_EX int gpgx_state_save(void *dest, int size)
|
||||
{
|
||||
return state_save((unsigned char*) dest) == size;
|
||||
}
|
||||
|
||||
GPGX_EX int gpgx_state_load(void *src, int size)
|
||||
{
|
||||
if (!size)
|
||||
return 0;
|
||||
|
||||
if (state_load((unsigned char *) src) == size)
|
||||
{
|
||||
update_viewport();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void osd_input_update(void)
|
||||
{
|
||||
}
|
||||
|
@ -178,6 +140,11 @@ GPGX_EX void gpgx_set_input_callback(ECL_ENTRY void (*fecb)(void))
|
|||
input_callback_cb = fecb;
|
||||
}
|
||||
|
||||
GPGX_EX void gpgx_set_cdd_callback(ECL_ENTRY void (*cddcb)(int lba, void *dest, int audio))
|
||||
{
|
||||
cdd_readcallback = cddcb;
|
||||
}
|
||||
|
||||
ECL_ENTRY int (*load_archive_cb)(const char *filename, unsigned char *buffer, int maxsize);
|
||||
|
||||
// return 0 on failure, else actual loaded size
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
*
|
||||
****************************************************************************************/
|
||||
#include "shared.h"
|
||||
#include "../cinterface/callbacks.h"
|
||||
|
||||
/* BCD conversion lookup tables */
|
||||
static const uint8 lut_BCD_8[100] =
|
||||
|
@ -119,13 +120,9 @@ static const unsigned char waveHeader[32] =
|
|||
|
||||
static blip_t* blip[2];
|
||||
|
||||
// FRONTEND INTERFACE
|
||||
void (*cdd_readcallback)(int lba, void *dest, int audio);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
toc_t toc;
|
||||
void (*cdd_readcallback)(int lba, void *dest, int audio);
|
||||
} frontendcd_t;
|
||||
|
||||
int cdd_load(const char *key, char *header)
|
||||
|
@ -140,7 +137,7 @@ int cdd_load(const char *key, char *header)
|
|||
return 0;
|
||||
|
||||
// look for valid header
|
||||
fecd.cdd_readcallback(0, data, 0);
|
||||
cdd_readcallback(0, data, 0);
|
||||
if (memcmp("SEGADISCSYSTEM", data, 14) == 0)
|
||||
startoffs = 0;
|
||||
else if (memcmp("SEGADISCSYSTEM", data + 16, 14) == 0)
|
||||
|
@ -151,7 +148,6 @@ int cdd_load(const char *key, char *header)
|
|||
memcpy(header, data + startoffs, 0x210);
|
||||
|
||||
// copy disk information
|
||||
cdd_readcallback = fecd.cdd_readcallback;
|
||||
memcpy(&cdd.toc, &fecd.toc, sizeof(toc_t));
|
||||
|
||||
cdd.loaded = 1;
|
||||
|
|
Loading…
Reference in New Issue