Fixed savestates: restore compatibility with lr and master
Add new maple devices from lr Clean up shil.cpp
This commit is contained in:
parent
4884dbc400
commit
4f8e18215b
|
@ -1179,9 +1179,6 @@ void WriteCommonReg8(u32 reg,u32 data)
|
|||
s16 cdda_sector[CDDA_SIZE]={0};
|
||||
u32 cdda_index=CDDA_SIZE<<1;
|
||||
|
||||
|
||||
SampleType mxlr[64];
|
||||
|
||||
u32 samples_gen;
|
||||
|
||||
//no DSP for now in this version
|
||||
|
@ -1192,6 +1189,7 @@ void AICA_Sample32()
|
|||
return;
|
||||
}
|
||||
|
||||
SampleType mxlr[64];
|
||||
memset(mxlr,0,sizeof(mxlr));
|
||||
|
||||
//Generate 32 samples for each channel, before moving to next channel
|
||||
|
|
|
@ -644,15 +644,15 @@ private:
|
|||
|
||||
virtual bool Serialize(void **data, unsigned int *total_size) override
|
||||
{
|
||||
REICAST_SA(&this->data[write_protect_size], size - write_protect_size);
|
||||
REICAST_S(state);
|
||||
REICAST_SA(&this->data[write_protect_size], size - write_protect_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool Unserialize(void **data, unsigned int *total_size) override
|
||||
{
|
||||
REICAST_USA(&this->data[write_protect_size], size - write_protect_size);
|
||||
REICAST_US(state);
|
||||
REICAST_USA(&this->data[write_protect_size], size - write_protect_size);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -245,7 +245,7 @@ void mcfg_SerializeDevices(void **data, unsigned int *total_size)
|
|||
}
|
||||
}
|
||||
|
||||
void mcfg_UnserializeDevices(void **data, unsigned int *total_size)
|
||||
void mcfg_UnserializeDevices(void **data, unsigned int *total_size, bool old)
|
||||
{
|
||||
mcfg_DestroyDevices();
|
||||
|
||||
|
@ -256,6 +256,42 @@ void mcfg_UnserializeDevices(void **data, unsigned int *total_size)
|
|||
MapleDeviceType device_type = (MapleDeviceType)**p;
|
||||
*p = *p + 1;
|
||||
*total_size = *total_size + 1;
|
||||
if (old)
|
||||
{
|
||||
switch (device_type)
|
||||
{
|
||||
case OldMapleDeviceType::MDT_None:
|
||||
device_type = MDT_None;
|
||||
break;
|
||||
case OldMapleDeviceType::MDT_SegaController:
|
||||
device_type = MDT_SegaController;
|
||||
break;
|
||||
case OldMapleDeviceType::MDT_SegaVMU:
|
||||
device_type = MDT_SegaVMU;
|
||||
break;
|
||||
case OldMapleDeviceType::MDT_PurupuruPack:
|
||||
device_type = MDT_PurupuruPack;
|
||||
break;
|
||||
case OldMapleDeviceType::MDT_Microphone:
|
||||
device_type = MDT_Microphone;
|
||||
break;
|
||||
case OldMapleDeviceType::MDT_Keyboard:
|
||||
device_type = MDT_Keyboard;
|
||||
break;
|
||||
case OldMapleDeviceType::MDT_Mouse:
|
||||
device_type = MDT_Mouse;
|
||||
break;
|
||||
case OldMapleDeviceType::MDT_LightGun:
|
||||
device_type = MDT_LightGun;
|
||||
break;
|
||||
case OldMapleDeviceType::MDT_NaomiJamma:
|
||||
device_type = MDT_NaomiJamma;
|
||||
break;
|
||||
default:
|
||||
die("Invalid maple device type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (device_type != MDT_None)
|
||||
{
|
||||
mcfg_Create(device_type, i, j);
|
||||
|
|
|
@ -64,6 +64,6 @@ void mcfg_CreateAtomisWaveControllers();
|
|||
|
||||
void mcfg_DestroyDevices();
|
||||
void mcfg_SerializeDevices(void **data, unsigned int *total_size);
|
||||
void mcfg_UnserializeDevices(void **data, unsigned int *total_size);
|
||||
void mcfg_UnserializeDevices(void **data, unsigned int *total_size, bool old_type_numbering);
|
||||
|
||||
bool maple_atomiswave_coin_chute(int slot);
|
||||
|
|
|
@ -2657,7 +2657,9 @@ maple_device* maple_Create(MapleDeviceType type)
|
|||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
ERROR_LOG(MAPLE, "Invalid device type %d", type);
|
||||
die("Invalid maple device type");
|
||||
break;
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -1,6 +1,27 @@
|
|||
#pragma once
|
||||
#include "types.h"
|
||||
|
||||
enum MapleDeviceType
|
||||
{
|
||||
MDT_SegaController,
|
||||
|
||||
MDT_SegaVMU,
|
||||
MDT_Microphone,
|
||||
MDT_PurupuruPack,
|
||||
MDT_AsciiStick,
|
||||
MDT_Keyboard,
|
||||
MDT_Mouse,
|
||||
MDT_LightGun,
|
||||
MDT_TwinStick,
|
||||
|
||||
MDT_NaomiJamma,
|
||||
|
||||
MDT_None,
|
||||
MDT_Count
|
||||
};
|
||||
|
||||
namespace OldMapleDeviceType
|
||||
{
|
||||
enum MapleDeviceType
|
||||
{
|
||||
MDT_SegaController,
|
||||
|
@ -17,6 +38,7 @@ enum MapleDeviceType
|
|||
MDT_None,
|
||||
MDT_Count
|
||||
};
|
||||
}
|
||||
|
||||
enum NAOMI_KEYS
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
//these are fixed
|
||||
/* TODO const */ u16 IRLPriority=0x0246;
|
||||
const u16 IRLPriority = 0x0246;
|
||||
#define IRLP9 &IRLPriority,0
|
||||
#define IRLP11 &IRLPriority,4
|
||||
#define IRLP13 &IRLPriority,8
|
||||
|
|
|
@ -1026,9 +1026,15 @@ void dc_loadstate()
|
|||
return;
|
||||
}
|
||||
|
||||
fread(data, 1, total_size, f) ;
|
||||
size_t read_size = fread(data, 1, total_size, f) ;
|
||||
fclose(f);
|
||||
|
||||
if (read_size != total_size)
|
||||
{
|
||||
WARN_LOG(SAVESTATE, "Failed to load state - I/O error");
|
||||
gui_display_notification("Failed to load state - I/O error", 2000);
|
||||
cleanup_serialize(data) ;
|
||||
return;
|
||||
}
|
||||
|
||||
data_ptr = data ;
|
||||
|
||||
|
@ -1040,13 +1046,16 @@ void dc_loadstate()
|
|||
#endif
|
||||
bm_Reset();
|
||||
|
||||
if ( ! dc_unserialize(&data_ptr, &total_size) )
|
||||
u32 unserialized_size = 0;
|
||||
if ( ! dc_unserialize(&data_ptr, &unserialized_size) )
|
||||
{
|
||||
WARN_LOG(SAVESTATE, "Failed to load state - could not unserialize data") ;
|
||||
gui_display_notification("Invalid save state", 2000);
|
||||
cleanup_serialize(data) ;
|
||||
return;
|
||||
}
|
||||
if (unserialized_size != total_size)
|
||||
WARN_LOG(SAVESTATE, "Save state error: read %d bytes but used %d", total_size, unserialized_size);
|
||||
|
||||
mmu_set_state();
|
||||
sh4_cpu.ResetCache();
|
||||
|
|
1011
core/serialize.cpp
1011
core/serialize.cpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue