diff --git a/Src/Memory/romMapperSg1000RamExpander.c b/Src/Memory/romMapperSg1000RamExpander.c
index aba9a94..1185f81 100644
--- a/Src/Memory/romMapperSg1000RamExpander.c
+++ b/Src/Memory/romMapperSg1000RamExpander.c
@@ -77,17 +77,27 @@ static void destroy(RomMapperSg1000RamExpander* rm)
free(rm->romData);
free(rm);
}
-
+
static UInt8 read(RomMapperSg1000RamExpander* rm, UInt16 address)
{
return rm->ram2[address & rm->mask2];
}
-
+
+static UInt8 read_ram1(RomMapperSg1000RamExpander* rm, UInt16 address)
+{
+ return rm->ram1[address - 0x2000];
+}
+
static void write(RomMapperSg1000RamExpander* rm, UInt16 address, UInt8 value)
{
rm->ram2[address & rm->mask2] = value;
}
+static void write_ram1(RomMapperSg1000RamExpander* rm, UInt16 address, UInt8 value)
+{
+ rm->ram1[address-0x2000] = value;
+}
+
int romMapperSg1000RamExpanderCreate(const char* filename, UInt8* romData,
int size, int slot, int sslot, int startPage, int type)
{
@@ -96,19 +106,19 @@ int romMapperSg1000RamExpanderCreate(const char* filename, UInt8* romData,
int pages = size / 0x2000 + ((size & 0x1fff) ? 1 : 0);
int i;
- if (size != 0x8000 || startPage != 0) {
- return 0;
- }
+ // Some ROMs are 48KB
+ // if (size != 0x8000 || startPage != 0) {
+ // return 0;
+ // }
rm = malloc(sizeof(RomMapperSg1000RamExpander));
rm->deviceHandle = deviceManagerRegister(type, &callbacks, rm);
- slotRegister(slot, sslot, startPage, pages, read, read, write, destroy, rm);
rm->romData = malloc(pages * 0x2000);
memcpy(rm->romData, romData, size);
- memset(rm->ram1, sizeof(rm->ram1), 0xff);
- memset(rm->ram2, sizeof(rm->ram2), 0xff);
+ memset(rm->ram1, 0xff, sizeof(rm->ram1));
+ memset(rm->ram2, 0xff, sizeof(rm->ram2));
rm->slot = slot;
rm->sslot = sslot;
@@ -118,15 +128,15 @@ int romMapperSg1000RamExpanderCreate(const char* filename, UInt8* romData,
for (i = 0; i < pages; i++) {
if (i + startPage >= 2) slot = 0;
if (type == ROM_SG1000_RAMEXPANDER_A && i + startPage == 1) {
- slotMapPage(slot, sslot, i + startPage, rm->ram1, 1, 1);
+ slotRegister(slot, sslot, i + startPage, 1, read_ram1, read_ram1, write_ram1, destroy, rm);
}
else {
slotMapPage(slot, sslot, i + startPage, rm->romData + 0x2000 * i, 1, 0);
}
}
- slotMapPage(slot, sslot, 6, NULL, 0, 0);
- slotMapPage(slot, sslot, 7, NULL, 0, 0);
+ slotMapPage(0, 0, 6, rm->ram2, 1, 1);
+ slotMapPage(0, 0, 7, rm->ram2, 1, 1);
return 1;
}
diff --git a/libretro.c b/libretro.c
index c272df1..14b3c2d 100644
--- a/libretro.c
+++ b/libretro.c
@@ -122,39 +122,39 @@ int get_media_type(const char* filename)
strcpy(workram, filename);
lower_string(workram);
- extension = workram + strlen(workram) - 4;
+ extension = workram + strlen(workram) - 3;
- if(strcmp(extension, ".dsk") == 0){
+ if(strcmp(extension, "dsk") == 0){
if (is_auto)
strcpy(msx_type, "MSX2+");
return MEDIA_TYPE_DISK;
}
- else if(strcmp(extension, ".m3u") == 0){
+ else if(strcmp(extension, "m3u") == 0){
if (is_auto)
strcpy(msx_type, "MSX2+");
return MEDIA_TYPE_DISK_BUNDLE;
}
- else if(strcmp(extension, ".cas") == 0){
+ else if(strcmp(extension, "cas") == 0){
if (is_auto)
strcpy(msx_type, "MSX2+");
return MEDIA_TYPE_TAPE;
}
- else if(strcmp(extension, ".rom") == 0){
+ else if(strcmp(extension, "rom") == 0){
if (is_auto)
strcpy(msx_type, "MSX2+");
return MEDIA_TYPE_CART;
}
- else if(strcmp(extension, ".mx1") == 0){
+ else if(strcmp(extension, "mx1") == 0){
if (is_auto)
strcpy(msx_type, "MSX2+");
return MEDIA_TYPE_CART;
}
- else if(strcmp(extension, ".mx2") == 0){
+ else if(strcmp(extension, "mx2") == 0){
if (is_auto)
strcpy(msx_type, "MSX2+");
return MEDIA_TYPE_CART;
}
- else if(strcmp(extension, ".col") == 0){
+ else if(strcmp(extension, "col") == 0){
if (is_auto){
is_coleco = true;
strcpy(msx_type, "COL - ColecoVision");
@@ -182,7 +182,7 @@ int get_media_type(const char* filename)
}
return MEDIA_TYPE_CART;
}
- else if(strcmp(extension, ".sf7") == 0){
+ else if(strcmp(extension, "sf7") == 0){
if (is_auto){
is_sega = true;
strcpy(msx_type, "SEGA - SF-7000");
@@ -196,7 +196,7 @@ int get_media_type(const char* filename)
}
return MEDIA_TYPE_CART;
}
- else if(strcmp(extension, ".omv") == 0){
+ else if(strcmp(extension, "omv") == 0){
if (is_auto){
is_sega = true;
strcpy(msx_type, "Othello Multivision");
@@ -899,7 +899,7 @@ bool retro_load_game(const struct retro_game_info *info)
if (info)
extract_directory(base_dir, info->path, sizeof(base_dir));
- check_variables(); // msx_type from configuration
+ check_variables(); // msx_type from configuration
if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir)
strcpy(properties_dir, dir);
diff --git a/system/bluemsx/Databases/segadb.xml b/system/bluemsx/Databases/segadb.xml
index 81ac96b..4713c5e 100644
--- a/system/bluemsx/Databases/segadb.xml
+++ b/system/bluemsx/Databases/segadb.xml
@@ -3278,4 +3278,137 @@ f0f128b25e5557e660d936995e6bf25c8ebd17e5
+
+ Rally-X
+ Sega
+ DahJee
+ 1986
+ TW
+
+
+
+ sg1000ramA
+ 0c1957a5faae5254c69f3331e79d87499dd7cf48
+
+
+
+
+
+ sg1000ramA
+ 21770691191b62bafec9099bbe0f9942f5480f83
+
+
+
+
+ Tank Battalion
+ Sega
+ DahJee
+ 1986
+ TW
+
+
+
+ sg1000ramA
+ 0ca3b740b28266a2a606127ed8967c684b67cb44
+
+
+
+
+ Yie Ar Kung-Fu II
+ Sega
+ DahJee
+ 1986
+ TW
+
+
+
+ sg1000ramA
+ 44fb2dca3774f859f0ae0ad4d809a67f760cf9ae
+
+
+
+
+ *Bomberman Special
+ Sega
+ DahJee
+ 1986
+ TW
+
+
+
+ sg1000ramA
+ d1d56bcd996df94458f5901dc537a5e30021256b
+
+
+
+
+
+ sg1000ramA
+ 455838571dd8287d491431e03269b0ccd292c8b8
+
+
+
+
+ Legend of Kage
+ Sega
+ DahJee
+ 1986
+ TW
+
+
+
+ sg1000ramA
+ 902dbb122bf0efc76604a876c3fae51c074bdc6a
+
+
+
+
+ Road Fighter
+ Sega
+ Jumbo
+ 1986
+ TW
+
+
+
+ sg1000ramA
+ 4f1a139974e3db27af5973bc9572ed68acd6ea68
+
+
+
+
+
+ sg1000ramA
+ 2755f74019dc94559fd0c2248e2ecb7f48879b90
+
+
+
+
+ Knightmare
+ Sega
+ Jumbo
+ 1986
+ TW
+
+
+
+ sg1000ramA
+ babdb6b109b20e81c28cd892c2042723e9cbff49
+
+
+
+
+ TwinBee
+ Sega
+ Jumbo
+ 1986
+ TW
+
+
+
+ sg1000ramA
+ a8c30043c145e63f79a3265dde167529f0e08d49
+
+
+