break stuff!
This commit is contained in:
parent
96dcb253aa
commit
d45faaa99c
|
@ -3221,7 +3221,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
case "GEN":
|
case "GEN":
|
||||||
{
|
{
|
||||||
//nextEmulator = new Genesis(nextComm, game, rom.RomData);
|
//nextEmulator = new Genesis(nextComm, game, rom.RomData);
|
||||||
nextEmulator = new BizHawk.Emulation.Cores.Consoles.Sega.gpgx.GPGX(nextComm, rom.RomData, "GEN", true, Emulation.Cores.Consoles.Sega.gpgx.GPGX.ControlType.Normal);
|
nextEmulator = new BizHawk.Emulation.Cores.Consoles.Sega.gpgx.GPGX(nextComm, rom.RomData, null, "GEN", true, Emulation.Cores.Consoles.Sega.gpgx.GPGX.ControlType.Normal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "TI83":
|
case "TI83":
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
{
|
{
|
||||||
static GPGX AttachedCore = null;
|
static GPGX AttachedCore = null;
|
||||||
|
|
||||||
|
DiscSystem.Disc CD;
|
||||||
byte[] romfile;
|
byte[] romfile;
|
||||||
|
|
||||||
bool disposed = false;
|
bool disposed = false;
|
||||||
|
@ -35,7 +36,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
Wayplay
|
Wayplay
|
||||||
};
|
};
|
||||||
|
|
||||||
public GPGX(CoreComm NextComm, byte[] romfile, string romextension, bool sixbutton, ControlType controls)
|
public GPGX(CoreComm NextComm, byte[] romfile, DiscSystem.Disc CD, string romextension, bool sixbutton, ControlType controls)
|
||||||
{
|
{
|
||||||
// three or six button?
|
// three or six button?
|
||||||
// http://www.sega-16.com/forum/showthread.php?4398-Forgotten-Worlds-giving-you-GAME-OVER-immediately-Fix-inside&highlight=forgotten%20worlds
|
// http://www.sega-16.com/forum/showthread.php?4398-Forgotten-Worlds-giving-you-GAME-OVER-immediately-Fix-inside&highlight=forgotten%20worlds
|
||||||
|
@ -130,7 +131,23 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filename == "PRIMARY_ROM")
|
if (filename == "PRIMARY_ROM")
|
||||||
|
{
|
||||||
|
if (romfile == null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Couldn't satisfy firmware request PRIMARY_ROM because none was provided.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
srcdata = romfile;
|
srcdata = romfile;
|
||||||
|
}
|
||||||
|
else if (filename == "PRIMARY_CD")
|
||||||
|
{
|
||||||
|
if (CD == null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Couldn't satisfy firmware request PRIMARY_CD because none was provided.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
srcdata = GetCDData();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// use fromtend firmware interface
|
// use fromtend firmware interface
|
||||||
|
@ -176,12 +193,62 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine("Couldn't satisfy firmware request {0} for unknown reasons", filename);
|
throw new Exception();
|
||||||
return 0;
|
//Console.WriteLine("Couldn't satisfy firmware request {0} for unknown reasons", filename);
|
||||||
|
//return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDRead(int lba, IntPtr dest)
|
||||||
|
{
|
||||||
|
byte[] data = new byte[2048];
|
||||||
|
CD.ReadLBA_2048(lba, data, 0);
|
||||||
|
Marshal.Copy(data, 0, dest, 2048);
|
||||||
|
}
|
||||||
|
|
||||||
|
LibGPGX.cd_read_cb cd_callback_handle;
|
||||||
|
|
||||||
|
unsafe byte[] GetCDData()
|
||||||
|
{
|
||||||
|
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.TOC.Sessions[0];
|
||||||
|
int ntrack = ses.Tracks.Count;
|
||||||
|
|
||||||
|
// bet you a dollar this is all wrong
|
||||||
|
for (int i = 0; i < LibGPGX.CD_MAX_TRACKS; i++)
|
||||||
|
{
|
||||||
|
if (i < ntrack)
|
||||||
|
{
|
||||||
|
ret.tracks[i].start = ses.Tracks[i].Indexes[1].aba - 150;
|
||||||
|
ret.tracks[i].end = ses.Tracks[i].length_aba + ret.tracks[i].start;
|
||||||
|
if (i == ntrack - 1)
|
||||||
|
{
|
||||||
|
ret.end = ret.tracks[i].end;
|
||||||
|
ret.last = ntrack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret.tracks[i].start = 0;
|
||||||
|
ret.tracks[i].end = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] retdata = new byte[size];
|
||||||
|
|
||||||
|
fixed (byte* p = &retdata[0])
|
||||||
|
{
|
||||||
|
Marshal.StructureToPtr(ret, (IntPtr)p, false);
|
||||||
|
}
|
||||||
|
return retdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region controller
|
#region controller
|
||||||
|
|
||||||
GPGXControlConverter ControlConverter;
|
GPGXControlConverter ControlConverter;
|
||||||
|
|
|
@ -192,6 +192,27 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public const int CD_MAX_TRACKS = 100;
|
||||||
|
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate void cd_read_cb(int lba, IntPtr dest);
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct CDTrack
|
||||||
|
{
|
||||||
|
public int start;
|
||||||
|
public int end;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public class CDData
|
||||||
|
{
|
||||||
|
public int end;
|
||||||
|
public int last;
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = CD_MAX_TRACKS)]
|
||||||
|
public readonly CDTrack[] tracks = new CDTrack[CD_MAX_TRACKS];
|
||||||
|
public cd_read_cb readcallback;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -64,11 +64,6 @@
|
||||||
/* CD track */
|
/* CD track */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
FILE *fd;
|
|
||||||
#ifdef USE_LIBTREMOR
|
|
||||||
OggVorbis_File vf;
|
|
||||||
#endif
|
|
||||||
int offset;
|
|
||||||
int start;
|
int start;
|
||||||
int end;
|
int end;
|
||||||
} track_t;
|
} track_t;
|
||||||
|
@ -92,7 +87,6 @@ typedef struct
|
||||||
int scanOffset;
|
int scanOffset;
|
||||||
int volume;
|
int volume;
|
||||||
uint8 status;
|
uint8 status;
|
||||||
uint16 sectorSize;
|
|
||||||
toc_t toc;
|
toc_t toc;
|
||||||
int16 audio[2];
|
int16 audio[2];
|
||||||
} cdd_t;
|
} cdd_t;
|
||||||
|
@ -102,7 +96,7 @@ extern void cdd_init(blip_t* left, blip_t* right);
|
||||||
extern void cdd_reset(void);
|
extern void cdd_reset(void);
|
||||||
extern int cdd_context_save(uint8 *state);
|
extern int cdd_context_save(uint8 *state);
|
||||||
extern int cdd_context_load(uint8 *state);
|
extern int cdd_context_load(uint8 *state);
|
||||||
extern int cdd_load(char *filename, char *header);
|
extern int cdd_load(void);
|
||||||
extern void cdd_unload(void);
|
extern void cdd_unload(void);
|
||||||
extern void cdd_read_data(uint8 *dst);
|
extern void cdd_read_data(uint8 *dst);
|
||||||
extern void cdd_read_audio(unsigned int samples);
|
extern void cdd_read_audio(unsigned int samples);
|
||||||
|
|
|
@ -541,7 +541,7 @@ int load_rom(char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* auto-detect CD image files */
|
/* auto-detect CD image files */
|
||||||
size = 0; //cdd_load(filename, (char *)(cart.rom));
|
size = cdd_load();
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
{
|
{
|
||||||
/* error opening file */
|
/* error opening file */
|
||||||
|
@ -730,7 +730,7 @@ int load_rom(char *filename)
|
||||||
|
|
||||||
/* automatically load associated .iso image */
|
/* automatically load associated .iso image */
|
||||||
strncpy(&filename[strlen(filename) - 4], ".iso", 4);
|
strncpy(&filename[strlen(filename) - 4], ".iso", 4);
|
||||||
cdd_load(filename, (char *)cdc.ram);
|
cdd_load(); // should this be checked for failure?
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue