use exceptions for startup errors

This commit is contained in:
Flyinghead 2019-07-11 19:23:21 +02:00
parent 5285911133
commit eb38564922
5 changed files with 205 additions and 318 deletions

View File

@ -19,6 +19,7 @@
// license:BSD-3-Clause
// copyright-holders:MetalliC
#include <memory>
#include "naomi_cart.h"
#include "naomi_regs.h"
#include "cfg/cfg.h"
@ -76,7 +77,7 @@ static bool naomi_LoadBios(const char *filename, Archive *child_archive, Archive
#else
std::string basepath = get_readonly_data_path("/");
#endif
Archive *bios_archive = OpenArchive((basepath + filename).c_str());
std::unique_ptr<Archive> bios_archive(OpenArchive((basepath + filename).c_str()));
bool found_region = false;
@ -99,60 +100,56 @@ static bool naomi_LoadBios(const char *filename, Archive *child_archive, Archive
}
else
{
ArchiveFile *file = NULL;
std::unique_ptr<ArchiveFile> file;
if (child_archive != NULL)
file = child_archive->OpenFile(bios->blobs[romid].filename);
if (file == NULL && parent_archive != NULL)
file = parent_archive->OpenFile(bios->blobs[romid].filename);
if (file == NULL && bios_archive != NULL)
file = bios_archive->OpenFile(bios->blobs[romid].filename);
file.reset(child_archive->OpenFile(bios->blobs[romid].filename));
if (!file && parent_archive != NULL)
file.reset(parent_archive->OpenFile(bios->blobs[romid].filename));
if (!file && bios_archive != NULL)
file.reset(bios_archive->OpenFile(bios->blobs[romid].filename));
if (!file) {
ERROR_LOG(NAOMI, "%s: Cannot open %s", filename, bios->blobs[romid].filename);
goto error;
WARN_LOG(NAOMI, "%s: Cannot open %s", filename, bios->blobs[romid].filename);
return false;
}
if (bios->blobs[romid].blob_type == Normal)
switch (bios->blobs[romid].blob_type)
{
verify(bios->blobs[romid].offset + bios->blobs[romid].length <= BIOS_SIZE);
u32 read = file->Read(sys_rom->data + bios->blobs[romid].offset, bios->blobs[romid].length);
DEBUG_LOG(NAOMI, "Mapped %s: %x bytes at %07x", bios->blobs[romid].filename, read, bios->blobs[romid].offset);
}
else if (bios->blobs[romid].blob_type == InterleavedWord)
{
u8 *buf = (u8 *)malloc(bios->blobs[romid].length);
if (buf == NULL)
case Normal:
{
ERROR_LOG(NAOMI, "malloc failed");
delete file;
goto error;
verify(bios->blobs[romid].offset + bios->blobs[romid].length <= BIOS_SIZE);
u32 read = file->Read(sys_rom->data + bios->blobs[romid].offset, bios->blobs[romid].length);
DEBUG_LOG(NAOMI, "Mapped %s: %x bytes at %07x", bios->blobs[romid].filename, read, bios->blobs[romid].offset);
}
verify(bios->blobs[romid].offset + bios->blobs[romid].length <= BIOS_SIZE);
u32 read = file->Read(buf, bios->blobs[romid].length);
u16 *to = (u16 *)(sys_rom->data + bios->blobs[romid].offset);
u16 *from = (u16 *)buf;
for (int i = bios->blobs[romid].length / 2; --i >= 0; to++)
*to++ = *from++;
free(buf);
DEBUG_LOG(NAOMI, "Mapped %s: %x bytes (interleaved word) at %07x", bios->blobs[romid].filename, read, bios->blobs[romid].offset);
}
else
break;
case InterleavedWord:
{
u8 *buf = (u8 *)malloc(bios->blobs[romid].length);
if (buf == NULL)
throw NaomiCartException(std::string("Memory allocation failed"));
verify(bios->blobs[romid].offset + bios->blobs[romid].length <= BIOS_SIZE);
u32 read = file->Read(buf, bios->blobs[romid].length);
u16 *to = (u16 *)(sys_rom->data + bios->blobs[romid].offset);
u16 *from = (u16 *)buf;
for (int i = bios->blobs[romid].length / 2; --i >= 0; to++)
*to++ = *from++;
free(buf);
DEBUG_LOG(NAOMI, "Mapped %s: %x bytes (interleaved word) at %07x", bios->blobs[romid].filename, read, bios->blobs[romid].offset);
}
break;
default:
die("Unknown blob type\n");
delete file;
break;
}
}
}
if (bios_archive != NULL)
delete bios_archive;
if (settings.platform.system == DC_PLATFORM_ATOMISWAVE)
// Reload the writeable portion of the FlashROM
sys_rom->Reload();
return found_region;
error:
if (bios_archive != NULL)
delete bios_archive;
return false;
}
static Game *FindGame(const char *filename)
@ -182,22 +179,21 @@ static Game *FindGame(const char *filename)
return &Games[gameid];
}
static bool naomi_cart_LoadZip(char *filename)
static void naomi_cart_LoadZip(const char *filename)
{
Game *game = FindGame(filename);
if (game == NULL)
{
ERROR_LOG(NAOMI, "Unknown game %s", filename);
return false;
}
Archive *archive = OpenArchive(filename);
throw NaomiCartException("Unknown game");
// Open archive and parent archive if any
std::unique_ptr<Archive> archive(OpenArchive(filename));
if (archive != NULL)
INFO_LOG(NAOMI, "Opened %s", filename);
Archive *parent_archive = NULL;
std::unique_ptr<Archive> parent_archive;
if (game->parent_name != NULL)
{
parent_archive = OpenArchive((get_game_dir() + game->parent_name).c_str());
parent_archive.reset(OpenArchive((get_game_dir() + game->parent_name).c_str()));
if (parent_archive != NULL)
INFO_LOG(NAOMI, "Opened %s", game->parent_name);
}
@ -205,166 +201,155 @@ static bool naomi_cart_LoadZip(char *filename)
if (archive == NULL && parent_archive == NULL)
{
if (game->parent_name != NULL)
ERROR_LOG(NAOMI, "Cannot open %s or %s", filename, game->parent_name);
throw NaomiCartException(std::string("Cannot open ") + filename + std::string(" or ") + game->parent_name);
else
ERROR_LOG(NAOMI, "Cannot open %s", filename);
return false;
throw NaomiCartException(std::string("Cannot open ") + filename);
}
// Load the BIOS
const char *bios = "naomi";
if (game->bios != NULL)
bios = game->bios;
u32 region_flag = settings.dreamcast.region;
if (region_flag > game->region_flag)
region_flag = game->region_flag;
if (!naomi_LoadBios(bios, archive, parent_archive, region_flag))
if (!naomi_LoadBios(bios, archive.get(), parent_archive.get(), region_flag))
{
WARN_LOG(NAOMI, "Warning: Region %d bios not found in %s", region_flag, bios);
if (!naomi_LoadBios(bios, archive, parent_archive, -1))
if (!naomi_LoadBios(bios, archive.get(), parent_archive.get(), -1))
{
// If a specific BIOS is needed for this game, fail.
if (game->bios != NULL || !bios_loaded)
{
ERROR_LOG(NAOMI, "Error: cannot load BIOS. Exiting");
return false;
}
throw NaomiCartException(std::string("Error: cannot load BIOS ") + (game->bios != NULL ? game->bios : "naomi.zip"));
// otherwise use the default BIOS
}
}
bios_loaded = true;
switch (game->cart_type)
{
case M1:
CurrentCartridge = new M1Cartridge(game->size);
break;
case M2:
CurrentCartridge = new M2Cartridge(game->size);
break;
case M4:
CurrentCartridge = new M4Cartridge(game->size);
break;
case AW:
CurrentCartridge = new AWCartridge(game->size);
break;
case GD:
// Now load the cartridge data
try {
switch (game->cart_type)
{
GDCartridge *gdcart = new GDCartridge(game->size);
gdcart->SetGDRomName(game->gdrom_name);
CurrentCartridge = gdcart;
}
break;
default:
die("Unsupported cartridge type\n");
break;
}
CurrentCartridge->SetKey(game->key);
NaomiGameInputs = game->inputs;
for (int romid = 0; game->blobs[romid].filename != NULL; romid++)
{
u32 len = game->blobs[romid].length;
if (game->blobs[romid].blob_type == Copy)
{
u8 *dst = (u8 *)CurrentCartridge->GetPtr(game->blobs[romid].offset, len);
u8 *src = (u8 *)CurrentCartridge->GetPtr(game->blobs[romid].src_offset, len);
memcpy(dst, src, game->blobs[romid].length);
DEBUG_LOG(NAOMI, "Copied: %x bytes from %07x to %07x", game->blobs[romid].length, game->blobs[romid].src_offset, game->blobs[romid].offset);
}
else
{
ArchiveFile* file = NULL;
if (archive != NULL)
file = archive->OpenFile(game->blobs[romid].filename);
if (file == NULL && parent_archive != NULL)
file = parent_archive->OpenFile(game->blobs[romid].filename);
if (!file) {
WARN_LOG(NAOMI, "%s: Cannot open %s", filename, game->blobs[romid].filename);
if (game->blobs[romid].blob_type != Eeprom)
// Default eeprom file is optional
goto error;
else
continue;
case M1:
CurrentCartridge = new M1Cartridge(game->size);
break;
case M2:
CurrentCartridge = new M2Cartridge(game->size);
break;
case M4:
CurrentCartridge = new M4Cartridge(game->size);
break;
case AW:
CurrentCartridge = new AWCartridge(game->size);
break;
case GD:
{
GDCartridge *gdcart = new GDCartridge(game->size);
gdcart->SetGDRomName(game->gdrom_name);
CurrentCartridge = gdcart;
}
if (game->blobs[romid].blob_type == Normal)
break;
default:
die("Unsupported cartridge type\n");
break;
}
CurrentCartridge->SetKey(game->key);
NaomiGameInputs = game->inputs;
for (int romid = 0; game->blobs[romid].filename != NULL; romid++)
{
u32 len = game->blobs[romid].length;
if (game->blobs[romid].blob_type == Copy)
{
u8 *dst = (u8 *)CurrentCartridge->GetPtr(game->blobs[romid].offset, len);
u32 read = file->Read(dst, game->blobs[romid].length);
DEBUG_LOG(NAOMI, "Mapped %s: %x bytes at %07x", game->blobs[romid].filename, read, game->blobs[romid].offset);
}
else if (game->blobs[romid].blob_type == InterleavedWord)
{
u8 *buf = (u8 *)malloc(game->blobs[romid].length);
if (buf == NULL)
{
ERROR_LOG(NAOMI, "malloc failed");
delete file;
goto error;
}
u32 read = file->Read(buf, game->blobs[romid].length);
u16 *to = (u16 *)CurrentCartridge->GetPtr(game->blobs[romid].offset, len);
u16 *from = (u16 *)buf;
for (int i = game->blobs[romid].length / 2; --i >= 0; to++)
*to++ = *from++;
free(buf);
DEBUG_LOG(NAOMI, "Mapped %s: %x bytes (interleaved word) at %07x", game->blobs[romid].filename, read, game->blobs[romid].offset);
}
else if (game->blobs[romid].blob_type == Key)
{
u8 *buf = (u8 *)malloc(game->blobs[romid].length);
if (buf == NULL)
{
ERROR_LOG(NAOMI, "malloc failed");
delete file;
goto error;
}
u32 read = file->Read(buf, game->blobs[romid].length);
CurrentCartridge->SetKeyData(buf);
DEBUG_LOG(NAOMI, "Loaded %s: %x bytes cart key", game->blobs[romid].filename, read);
}
else if (game->blobs[romid].blob_type == Eeprom)
{
naomi_default_eeprom = (u8 *)malloc(game->blobs[romid].length);
if (naomi_default_eeprom == NULL)
{
ERROR_LOG(NAOMI, "malloc failed");
delete file;
goto error;
}
u32 read = file->Read(naomi_default_eeprom, game->blobs[romid].length);
DEBUG_LOG(NAOMI, "Loaded %s: %x bytes default eeprom", game->blobs[romid].filename, read);
u8 *src = (u8 *)CurrentCartridge->GetPtr(game->blobs[romid].src_offset, len);
memcpy(dst, src, game->blobs[romid].length);
DEBUG_LOG(NAOMI, "Copied: %x bytes from %07x to %07x", game->blobs[romid].length, game->blobs[romid].src_offset, game->blobs[romid].offset);
}
else
die("Unknown blob type\n");
delete file;
{
std::unique_ptr<ArchiveFile> file;
if (archive != NULL)
file.reset(archive->OpenFile(game->blobs[romid].filename));
if (file == NULL && parent_archive != NULL)
file.reset(parent_archive->OpenFile(game->blobs[romid].filename));
if (!file) {
WARN_LOG(NAOMI, "%s: Cannot open %s", filename, game->blobs[romid].filename);
if (game->blobs[romid].blob_type != Eeprom)
// Default eeprom file is optional
throw NaomiCartException(std::string("Cannot find ") + game->blobs[romid].filename);
else
continue;
}
switch (game->blobs[romid].blob_type)
{
case Normal:
{
u8 *dst = (u8 *)CurrentCartridge->GetPtr(game->blobs[romid].offset, len);
u32 read = file->Read(dst, game->blobs[romid].length);
DEBUG_LOG(NAOMI, "Mapped %s: %x bytes at %07x", game->blobs[romid].filename, read, game->blobs[romid].offset);
}
break;
case InterleavedWord:
{
u8 *buf = (u8 *)malloc(game->blobs[romid].length);
if (buf == NULL)
throw NaomiCartException(std::string("Memory allocation failed"));
u32 read = file->Read(buf, game->blobs[romid].length);
u16 *to = (u16 *)CurrentCartridge->GetPtr(game->blobs[romid].offset, len);
u16 *from = (u16 *)buf;
for (int i = game->blobs[romid].length / 2; --i >= 0; to++)
*to++ = *from++;
free(buf);
DEBUG_LOG(NAOMI, "Mapped %s: %x bytes (interleaved word) at %07x", game->blobs[romid].filename, read, game->blobs[romid].offset);
}
break;
case Key:
{
u8 *buf = (u8 *)malloc(game->blobs[romid].length);
if (buf == NULL)
throw NaomiCartException(std::string("Memory allocation failed"));
u32 read = file->Read(buf, game->blobs[romid].length);
CurrentCartridge->SetKeyData(buf);
DEBUG_LOG(NAOMI, "Loaded %s: %x bytes cart key", game->blobs[romid].filename, read);
}
break;
case Eeprom:
{
naomi_default_eeprom = (u8 *)malloc(game->blobs[romid].length);
if (naomi_default_eeprom == NULL)
throw NaomiCartException(std::string("Memory allocation failed"));
u32 read = file->Read(naomi_default_eeprom, game->blobs[romid].length);
DEBUG_LOG(NAOMI, "Loaded %s: %x bytes default eeprom", game->blobs[romid].filename, read);
}
break;
default:
die("Unknown blob type\n");
break;
}
}
}
}
if (archive != NULL)
delete archive;
if (parent_archive != NULL)
delete parent_archive;
try {
CurrentCartridge->Init();
} catch (NaomiCartException& e) {
ERROR_LOG(NAOMI, "%s", e.reason.c_str());
return false;
strcpy(naomi_game_id, CurrentCartridge->GetGameId().c_str());
NOTICE_LOG(NAOMI, "NAOMI GAME ID [%s]", naomi_game_id);
} catch (ReicastException& ex) {
delete CurrentCartridge;
CurrentCartridge = NULL;
throw ex;
}
strcpy(naomi_game_id, CurrentCartridge->GetGameId().c_str());
NOTICE_LOG(NAOMI, "NAOMI GAME ID [%s]", naomi_game_id);
return true;
error:
if (archive != NULL)
delete archive;
if (parent_archive != NULL)
delete parent_archive;
delete CurrentCartridge;
CurrentCartridge = NULL;
return false;
}
#if HOST_OS == OS_WINDOWS
@ -373,7 +358,7 @@ error:
#define CloseFile(f) close(f)
#endif
bool naomi_cart_LoadRom(char* file)
void naomi_cart_LoadRom(const char* file)
{
INFO_LOG(NAOMI, "nullDC-Naomi rom loader v1.2");
@ -396,12 +381,15 @@ bool naomi_cart_LoadRom(char* file)
u32 setsize = 0;
bool raw_bin_file = false;
char *pdot = strrchr(file, '.');
const char *pdot = strrchr(file, '.');
if (pdot != NULL
&& (!strcmp(pdot, ".zip") || !strcmp(pdot, ".ZIP")
|| !strcmp(pdot, ".7z") || !strcmp(pdot, ".7Z")))
return naomi_cart_LoadZip(file);
{
naomi_cart_LoadZip(file);
return;
}
// Try to load BIOS from naomi.zip
if (!naomi_LoadBios("naomi", NULL, NULL, settings.dreamcast.region))
@ -410,10 +398,7 @@ bool naomi_cart_LoadRom(char* file)
if (!naomi_LoadBios("naomi", NULL, NULL, -1))
{
if (!bios_loaded)
{
ERROR_LOG(NAOMI, "Error: cannot load BIOS. Exiting");
return false;
}
throw new ReicastException("Error: cannot load BIOS from naomi.zip");
}
}
@ -426,13 +411,13 @@ bool naomi_cart_LoadRom(char* file)
FILE* fl = fopen(t, "r");
if (!fl)
return false;
throw new ReicastException("Error: can't open " + std::string(t));
char* line = fgets(t, 512, fl);
if (!line)
{
fclose(fl);
return false;
throw new ReicastException("Error: Invalid LST file");
}
char* eon = strstr(line, "\n");
@ -447,7 +432,7 @@ bool naomi_cart_LoadRom(char* file)
if (!line)
{
fclose(fl);
return false;
throw new ReicastException("Error: Invalid LST file");
}
RomSize = 0;
@ -476,7 +461,7 @@ bool naomi_cart_LoadRom(char* file)
// BIN loading
FILE* fp = fopen(t, "rb");
if (fp == NULL)
return false;
throw new ReicastException("Error: can't open " + std::string(t));
fseek(fp, 0, SEEK_END);
u32 file_size = ftell(fp);
@ -569,7 +554,7 @@ bool naomi_cart_LoadRom(char* file)
for (size_t i = 0; i < files.size(); i++)
if (RomCacheMap[i] != INVALID_FD)
CloseFile(RomCacheMap[i]);
return false;
throw new ReicastException("Error: Failed to load BIN/DAT file");
}
//We have all file mapping objects, we start to map the ram
@ -592,7 +577,7 @@ bool naomi_cart_LoadRom(char* file)
if (!mapped)
{
ERROR_LOG(NAOMI, "-Mapping ROM FAILED: %s @ %08x size %x", files[i].c_str(), fstart[i], fsize[i]);
return false;
throw new ReicastException("Memory mapping of ROM failed");
}
}
}
@ -604,7 +589,7 @@ bool naomi_cart_LoadRom(char* file)
strcpy(naomi_game_id, CurrentCartridge->GetGameId().c_str());
NOTICE_LOG(NAOMI, "NAOMI GAME ID [%s]", naomi_game_id);
return true;
return;
}
void naomi_cart_Close()
@ -626,23 +611,6 @@ void naomi_cart_Close()
bios_loaded = false;
}
bool naomi_cart_SelectFile()
{
char SelectedFile[512];
cfgLoadStr("config", "image", SelectedFile, "null");
if (!naomi_cart_LoadRom(SelectedFile))
{
ERROR_LOG(NAOMI, "Cannot load %s: error %d", SelectedFile, errno);
cfgSetVirtual("config", "image", "");
return false;
}
return true;
}
int naomi_cart_GetPlatform(const char *path)
{
Game *game = FindGame(path);

View File

@ -85,15 +85,13 @@ private:
u8 naomi_cart_ram[64 * 1024];
};
class NaomiCartException
class NaomiCartException : public ReicastException
{
public:
NaomiCartException(std::string reason) : reason(reason) {}
std::string reason;
NaomiCartException(std::string reason) : ReicastException(reason) {}
};
bool naomi_cart_SelectFile();
void naomi_cart_LoadRom(const char* file);
void naomi_cart_Close();
int naomi_cart_GetPlatform(const char *path);

View File

@ -400,18 +400,18 @@ void set_platform(int platform)
_vmem_init_mappings();
}
static int dc_init()
static void dc_init()
{
static bool init_done;
if (init_done)
return 0;
return;
// Default platform
set_platform(DC_PLATFORM_DREAMCAST);
if (plugins_Init())
return -3;
plugins_Init();
#if FEAT_SHREC != DYNAREC_NONE
Get_Sh4Recompiler(&sh4_cpu);
sh4_cpu.Init(); // Also initialize the interpreter
@ -430,8 +430,6 @@ static int dc_init()
mem_Init();
init_done = true;
return 0;
}
bool game_started;
@ -453,14 +451,12 @@ static int get_game_platform(const char *path)
return DC_PLATFORM_DREAMCAST;
}
int dc_start_game(const char *path)
void dc_start_game(const char *path)
{
if (path != NULL)
cfgSetVirtual("config", "image", path);
int rc = dc_init();
if (rc != 0)
return rc;
dc_init();
set_platform(get_game_platform(path));
mem_map_default();
@ -476,20 +472,14 @@ int dc_start_game(const char *path)
if (settings.bios.UseReios)
{
if (!LoadHle(get_readonly_data_path(DATA_PATH)))
{
ERROR_LOG(BOOT, "Cannot init HLE BIOS");
return -5;
}
else
{
NOTICE_LOG(BOOT, "Did not load bios, using reios");
}
throw ReicastException("Failed to initialize HLE BIOS");
NOTICE_LOG(BOOT, "Did not load BIOS, using reios");
}
else
#endif
{
ERROR_LOG(BOOT, "Cannot find BIOS files");
return -5;
throw ReicastException("Cannot find BIOS files");
}
}
}
@ -512,8 +502,7 @@ int dc_start_game(const char *path)
}
else if (settings.platform.system == DC_PLATFORM_NAOMI || settings.platform.system == DC_PLATFORM_ATOMISWAVE)
{
if (!naomi_cart_SelectFile())
return -6;
naomi_cart_LoadRom(path);
LoadCustom();
if (settings.platform.system == DC_PLATFORM_NAOMI)
mcfg_CreateNAOMIJamma();
@ -522,8 +511,6 @@ int dc_start_game(const char *path)
}
game_started = true;
dc_resume();
return 0;
}
bool dc_is_running()

View File

@ -49,7 +49,7 @@ extern void dc_savestate();
extern void dc_stop();
extern void dc_reset(bool manual);
extern void dc_resume();
extern int dc_start_game(const char *path);
extern void dc_start_game(const char *path);
extern void UpdateInputState(u32 port);
extern bool game_started;
@ -349,14 +349,6 @@ static void gui_display_commands()
cfgSetVirtual("config", "image", "");
}
#if 0
ImGui::NextColumn();
if (ImGui::Button("RenderDone Int", ImVec2(150 * scaling, 50 * scaling)))
{
asic_RaiseInterrupt(holly_RENDER_DONE);
gui_state = Closed;
}
#endif
ImGui::End();
ImGui::Render();
@ -1413,25 +1405,14 @@ static void gui_display_demo()
static void gui_start_game(const std::string& path)
{
int rc = dc_start_game(path.empty() ? NULL : path.c_str());
if (rc != 0)
{
try {
dc_start_game(path.empty() ? NULL : path.c_str());
} catch (ReicastException& ex) {
ERROR_LOG(BOOT, "%s", ex.reason.c_str());
error_msg = ex.reason;
gui_state = Main;
game_started = false;
cfgSetVirtual("config", "image", "");
switch (rc) {
case -3:
error_msg = "Audio/video initialization failed";
break;
case -5:
error_msg = "Cannot find BIOS files";
break;
case -6:
error_msg = "Cannot load NAOMI rom or BIOS";
break;
default:
break;
}
}
}

View File

@ -271,60 +271,6 @@ void libARM_InterruptChange(u32 bits,u32 L);
void libCore_CDDA_Sector(s16* sector);
//passed on AICA init call
//Ram/Regs are managed by plugin , exept RTC regs (managed by main emu)
//******************************************************
//******************** ARM Sound CPU *******************
//******************************************************
//******************************************************
//****************** Maple devices ******************
//******************************************************
enum MapleDeviceCreationFlags
{
MDCF_None=0,
MDCF_Hotplug=1
};
struct maple_subdevice_instance;
struct maple_device_instance;
//buffer_out_len and responce need to be filled w/ proper info by the plugin
//buffer_in must not be edited (its direct pointer on ram)
//output buffer must contain the frame data , the frame header is generated by the maple routing code
//typedef u32 FASTCALL MapleSubDeviceDMAFP(void* device_instance,u32 Command,u32* buffer_in,u32 buffer_in_len,u32* buffer_out,u32& buffer_out_len);
typedef u32 MapleDeviceDMAFP(void* device_instance,u32 Command,u32* buffer_in,u32 buffer_in_len,u32* buffer_out,u32& buffer_out_len);
struct maple_subdevice_instance
{
//port
u8 port;
//user data
void* data;
//MapleDeviceDMA
MapleDeviceDMAFP* dma;
bool connected;
u32 reserved; //reserved for the emu , DO NOT EDIT
};
struct maple_device_instance
{
//port
u8 port;
//user data
void* data;
//MapleDeviceDMA
MapleDeviceDMAFP* dma;
bool connected;
maple_subdevice_instance subdevices[5];
};
//includes from CRT
#include <stdlib.h>
#include <stdio.h>
@ -914,3 +860,10 @@ struct OnLoad
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
class ReicastException
{
public:
ReicastException(std::string reason) : reason(reason) {}
std::string reason;
};