diff --git a/desmume/src/Database.cpp b/desmume/src/Database.cpp new file mode 100644 index 000000000..6029e5c21 --- /dev/null +++ b/desmume/src/Database.cpp @@ -0,0 +1,392 @@ +/* + Copyright (C) 2008-2016 DeSmuME team + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the this software. If not, see . +*/ + +#include + +#include "types.h" +#include "Database.h" +#include "retro_miscellaneous.h" + +//------------------------------------------------------------ +//large databases are first. scroll down to ENDLARGE to find the code + +struct MAKER +{ + u16 code; + const char* name; +}; + + +static const char regions_index[] = "JPFSEODIRKHXVWUC"; +static const char *regions[] = { + "JPN", // J + "EUR", // P + "FRA", // F + "ESP", // S + "USA", // E + "INT", // O + "NOE", // D + "ITA", // I + "RUS", // R + "KOR", // K + "HOL", // H + "EUU", // X + "EUU", // V + "EUU", // W + "AUS", // U + "CHN", // C +}; + +static MAKER makerCodes[] = { + { 0x3130, "Nintendo" }, + { 0x3230, "Rocket Games, Ajinomoto" }, + { 0x3330, "Imagineer-Zoom" }, + { 0x3430, "Gray Matter?" }, + { 0x3530, "Zamuse" }, + { 0x3630, "Falcom" }, + { 0x3730, "Enix?" }, + { 0x3830, "Capcom" }, + { 0x3930, "Hot B Co." }, + { 0x4130, "Jaleco" }, + { 0x4230, "Coconuts Japan" }, + { 0x4330, "Coconuts Japan/G.X.Media" }, + { 0x4430, "Micronet?" }, + { 0x4530, "Technos" }, + { 0x4630, "Mebio Software" }, + { 0x4730, "Shouei System" }, + { 0x4830, "Starfish" }, + { 0x4A30, "Mitsui Fudosan/Dentsu" }, + { 0x4C30, "Warashi Inc." }, + { 0x4E30, "Nowpro" }, + { 0x5030, "Game Village" }, + { 0x3031, "?????????????" }, + { 0x3231, "Infocom" }, + { 0x3331, "Electronic Arts Japan" }, + { 0x3531, "Cobra Team" }, + { 0x3631, "Human/Field" }, + { 0x3731, "KOEI" }, + { 0x3831, "Hudson Soft" }, + { 0x3931, "S.C.P." }, + { 0x4131, "Yanoman" }, + { 0x4331, "Tecmo Products" }, + { 0x4431, "Japan Glary Business" }, + { 0x4531, "Forum/OpenSystem" }, + { 0x4631, "Virgin Games" }, + { 0x4731, "SMDE" }, + { 0x4A31, "Daikokudenki" }, + { 0x5031, "Creatures Inc." }, + { 0x5131, "TDK Deep Impresion" }, + { 0x3032, "Destination Software, KSS" }, + { 0x3132, "Sunsoft/Tokai Engineering??" }, + { 0x3232, "POW, VR 1 Japan??" }, + { 0x3332, "Micro World" }, + { 0x3532, "San-X" }, + { 0x3632, "Enix" }, + { 0x3732, "Loriciel/Electro Brain" }, + { 0x3832, "Kemco Japan" }, + { 0x3932, "Seta" }, + { 0x4132, "Culture Brain" }, + { 0x4332, "Palsoft" }, + { 0x4432, "Visit Co.,Ltd." }, + { 0x4532, "Intec" }, + { 0x4632, "System Sacom" }, + { 0x4732, "Poppo" }, + { 0x4832, "Ubisoft Japan" }, + { 0x4A32, "Media Works" }, + { 0x4B32, "NEC InterChannel" }, + { 0x4C32, "Tam" }, + { 0x4D32, "Jordan" }, + { 0x4E32, "Smilesoft ???, Rocket ???" }, + { 0x5132, "Mediakite" }, + { 0x3033, "Viacom" }, + { 0x3133, "Carrozzeria" }, + { 0x3233, "Dynamic" }, + { 0x3433, "Magifact" }, + { 0x3533, "Hect" }, + { 0x3633, "Codemasters" }, + { 0x3733, "Taito/GAGA Communications" }, + { 0x3833, "Laguna" }, + { 0x3933, "Telstar Fun & Games, Event/Taito" }, + { 0x4233, "Arcade Zone Ltd" }, + { 0x4333, "Entertainment International/Empire Software?" }, + { 0x4433, "Loriciel" }, + { 0x4533, "Gremlin Graphics" }, + { 0x4633, "K.Amusement Leasing Co." }, + { 0x3034, "Seika Corp." }, + { 0x3134, "Ubi Soft Entertainment" }, + { 0x3234, "Sunsoft US?" }, + { 0x3434, "Life Fitness" }, + { 0x3634, "System 3" }, + { 0x3734, "Spectrum Holobyte" }, + { 0x3934, "IREM" }, + { 0x4234, "Raya Systems" }, + { 0x4334, "Renovation Products" }, + { 0x4434, "Malibu Games" }, + { 0x4634, "Eidos (was U.S. Gold <=1995)" }, + { 0x4734, "Playmates Interactive?" }, + { 0x4A34, "Fox Interactive" }, + { 0x4B34, "Time Warner Interactive" }, + { 0x5134, "Disney Interactive" }, + { 0x5334, "Black Pearl" }, + { 0x5534, "Advanced Productions" }, + { 0x5834, "GT Interactive" }, + { 0x5934, "RARE?" }, + { 0x5A34, "Crave Entertainment" }, + { 0x3035, "Absolute Entertainment" }, + { 0x3135, "Acclaim" }, + { 0x3235, "Activision" }, + { 0x3335, "American Sammy" }, + { 0x3435, "Take 2 Interactive (before it was GameTek)" }, + { 0x3535, "Hi Tech" }, + { 0x3635, "LJN LTD." }, + { 0x3835, "Mattel" }, + { 0x4135, "Mindscape, Red Orb Entertainment?" }, + { 0x4235, "Romstar" }, + { 0x4335, "Taxan" }, + { 0x4435, "Midway (before it was Tradewest)" }, + { 0x4635, "American Softworks" }, + { 0x4735, "Majesco Sales Inc" }, + { 0x4835, "3DO" }, + { 0x4B35, "Hasbro" }, + { 0x4C35, "NewKidCo" }, + { 0x4D35, "Telegames" }, + { 0x4E35, "Metro3D" }, + { 0x5035, "Vatical Entertainment" }, + { 0x5135, "LEGO Media" }, + { 0x5335, "Xicat Interactive" }, + { 0x5435, "Cryo Interactive" }, + { 0x5735, "Red Storm Entertainment" }, + { 0x5835, "Microids" }, + { 0x5A35, "Conspiracy/Swing" }, + { 0x3036, "Titus" }, + { 0x3136, "Virgin Interactive" }, + { 0x3236, "Maxis" }, + { 0x3436, "LucasArts Entertainment" }, + { 0x3736, "Ocean" }, + { 0x3936, "Electronic Arts" }, + { 0x4236, "Laser Beam" }, + { 0x4536, "Elite Systems" }, + { 0x4636, "Electro Brain" }, + { 0x4736, "The Learning Company" }, + { 0x4836, "BBC" }, + { 0x4A36, "Software 2000" }, + { 0x4C36, "BAM! Entertainment" }, + { 0x4D36, "Studio 3" }, + { 0x5136, "Classified Games" }, + { 0x5336, "TDK Mediactive" }, + { 0x5536, "DreamCatcher" }, + { 0x5636, "JoWood Produtions" }, + { 0x5736, "SEGA" }, + { 0x5836, "Wannado Edition" }, + { 0x5936, "LSP" }, + { 0x5A36, "ITE Media" }, + { 0x3037, "Infogrames" }, + { 0x3137, "Interplay" }, + { 0x3237, "JVC" }, + { 0x3337, "Parker Brothers" }, + { 0x3537, "Sales Curve" }, + { 0x3837, "THQ" }, + { 0x3937, "Accolade" }, + { 0x4137, "Triffix Entertainment" }, + { 0x4337, "Microprose Software" }, + { 0x4437, "Universal Interactive, Sierra, Simon & Schuster?" }, + { 0x4637, "Kemco" }, + { 0x4737, "Rage Software" }, + { 0x4837, "Encore" }, + { 0x4A37, "Zoo" }, + { 0x4B37, "BVM" }, + { 0x4C37, "Simon & Schuster Interactive" }, + { 0x4D37, "Asmik Ace Entertainment Inc./AIA" }, + { 0x4E37, "Empire Interactive?" }, + { 0x5137, "Jester Interactive" }, + { 0x5437, "Scholastic" }, + { 0x5537, "Ignition Entertainment" }, + { 0x5737, "Stadlbauer" }, + { 0x3038, "Misawa" }, + { 0x3138, "Teichiku" }, + { 0x3238, "Namco Ltd." }, + { 0x3338, "LOZC" }, + { 0x3438, "KOEI" }, + { 0x3638, "Tokuma Shoten Intermedia" }, + { 0x3738, "Tsukuda Original" }, + { 0x3838, "DATAM-Polystar" }, + { 0x4238, "Bulletproof Software" }, + { 0x4338, "Vic Tokai Inc." }, + { 0x4538, "Character Soft" }, + { 0x4638, "I'Max" }, + { 0x4738, "Saurus" }, + { 0x4A38, "General Entertainment" }, + { 0x4E38, "Success" }, + { 0x5038, "SEGA Japan" }, + { 0x3039, "Takara Amusement" }, + { 0x3139, "Chun Soft" }, + { 0x3239, "Video System, McO'River???" }, + { 0x3339, "BEC" }, + { 0x3539, "Varie" }, + { 0x3639, "Yonezawa/S'pal" }, + { 0x3739, "Kaneko" }, + { 0x3939, "Victor Interactive Software, Pack in Video" }, + { 0x4139, "Nichibutsu/Nihon Bussan" }, + { 0x4239, "Tecmo" }, + { 0x4339, "Imagineer" }, + { 0x4639, "Nova" }, + { 0x4739, "Den'Z" }, + { 0x4839, "Bottom Up" }, + { 0x4A39, "TGL" }, + { 0x4C39, "Hasbro Japan?" }, + { 0x4E39, "Marvelous Entertainment" }, + { 0x5039, "Keynet Inc." }, + { 0x5139, "Hands-On Entertainment" }, + { 0x3041, "Telenet" }, + { 0x3141, "Hori" }, + { 0x3441, "Konami" }, + { 0x3541, "K.Amusement Leasing Co." }, + { 0x3641, "Kawada" }, + { 0x3741, "Takara" }, + { 0x3941, "Technos Japan Corp." }, + { 0x4141, "JVC, Victor Musical Indutries" }, + { 0x4341, "Toei Animation" }, + { 0x4441, "Toho" }, + { 0x4641, "Namco" }, + { 0x4741, "Media Rings Corporation" }, + { 0x4841, "J-Wing" }, + { 0x4A41, "Pioneer LDC" }, + { 0x4B41, "KID" }, + { 0x4C41, "Mediafactory" }, + { 0x5041, "Infogrames Hudson" }, + { 0x5141, "Kiratto. Ludic Inc" }, + { 0x3042, "Acclaim Japan" }, + { 0x3142, "ASCII (was Nexoft?)" }, + { 0x3242, "Bandai" }, + { 0x3442, "Enix" }, + { 0x3642, "HAL Laboratory" }, + { 0x3742, "SNK" }, + { 0x3942, "Pony Canyon" }, + { 0x4142, "Culture Brain" }, + { 0x4242, "Sunsoft" }, + { 0x4342, "Toshiba EMI" }, + { 0x4442, "Sony Imagesoft" }, + { 0x4642, "Sammy" }, + { 0x4742, "Magical" }, + { 0x4842, "Visco" }, + { 0x4A42, "Compile " }, + { 0x4C42, "MTO Inc." }, + { 0x4E42, "Sunrise Interactive" }, + { 0x5042, "Global A Entertainment" }, + { 0x5142, "Fuuki" }, + { 0x3043, "Taito" }, + { 0x3243, "Kemco" }, + { 0x3343, "Square" }, + { 0x3443, "Tokuma Shoten" }, + { 0x3543, "Data East" }, + { 0x3643, "Tonkin House (was Tokyo Shoseki)" }, + { 0x3843, "Koei" }, + { 0x4143, "Konami/Ultra/Palcom" }, + { 0x4243, "NTVIC/VAP" }, + { 0x4343, "Use Co.,Ltd." }, + { 0x4443, "Meldac" }, + { 0x4543, "Pony Canyon" }, + { 0x4643, "Angel, Sotsu Agency/Sunrise" }, + { 0x4A43, "Boss" }, + { 0x4743, "Yumedia/Aroma Co., Ltd" }, + { 0x4B43, "Axela/Crea-Tech?" }, + { 0x4C43, "Sekaibunka-Sha, Sumire kobo?, Marigul Management Inc.?" }, + { 0x4D43, "Konami Computer Entertainment Osaka" }, + { 0x5043, "Enterbrain" }, + { 0x3044, "Taito/Disco" }, + { 0x3144, "Sofel" }, + { 0x3244, "Quest, Bothtec" }, + { 0x3344, "Sigma, ?????" }, + { 0x3444, "Ask Kodansha" }, + { 0x3644, "Naxat" }, + { 0x3744, "Copya System" }, + { 0x3844, "Capcom Co., Ltd." }, + { 0x3944, "Banpresto" }, + { 0x4144, "TOMY" }, + { 0x4244, "LJN Japan" }, + { 0x4444, "NCS" }, + { 0x4544, "Human Entertainment" }, + { 0x4644, "Altron" }, + { 0x4744, "Jaleco???" }, + { 0x4844, "Gaps Inc." }, + { 0x4C44, "????" }, + { 0x4E44, "Elf" }, + { 0x3045, "Jaleco" }, + { 0x3145, "????" }, + { 0x3245, "Yutaka" }, + { 0x3345, "Varie" }, + { 0x3445, "T&ESoft" }, + { 0x3545, "Epoch" }, + { 0x3745, "Athena" }, + { 0x3845, "Asmik" }, + { 0x3945, "Natsume" }, + { 0x4145, "King Records" }, + { 0x4245, "Atlus" }, + { 0x4345, "Epic/Sony Records" }, + { 0x4545, "IGS" }, + { 0x4745, "Chatnoir" }, + { 0x4845, "Right Stuff" }, + { 0x4C45, "Spike" }, + { 0x4D45, "Konami Computer Entertainment Tokyo" }, + { 0x4E45, "Alphadream Corporation" }, + { 0x3046, "A Wave" }, + { 0x3146, "Motown Software" }, + { 0x3246, "Left Field Entertainment" }, + { 0x3346, "Extreme Ent. Grp." }, + { 0x3446, "TecMagik" }, + { 0x3946, "Cybersoft" }, + { 0x4246, "Psygnosis" }, + { 0x4546, "Davidson/Western Tech." }, + { 0x3147, "PCCW Japan" }, + { 0x3447, "KiKi Co Ltd" }, + { 0x3547, "Open Sesame Inc???" }, + { 0x3647, "Sims" }, + { 0x3747, "Broccoli" }, + { 0x3847, "Avex" }, + { 0x3947, "D3 Publisher" }, + { 0x4247, "Konami Computer Entertainment Japan" }, + { 0x4447, "Square-Enix" }, + { 0x4849, "Yojigen" }, +}; + +//------------------------------------------------------------ +//ENDLARGE +//------------------------------------------------------------ + +namespace Database +{ + const char* RegionXXXForCode(char code, bool unknownAsString) + { + size_t regions_num = ARRAY_SIZE(regions); + + const char* found = strchr(regions_index,code); + if(found) return regions[found-regions_index]; + else return unknownAsString ? "???" : NULL; + } + + const char *MakerNameForMakerCode(u16 id, bool unknownAsString) + { + //too bad these aren't sorted + for (int i = 0; i < ARRAY_SIZE(makerCodes); i++) + { + if (makerCodes[i].code == id) + return makerCodes[i].name; + } + + return unknownAsString ? "Unknown" : NULL; + } +} diff --git a/desmume/src/Database.h b/desmume/src/Database.h new file mode 100644 index 000000000..acae97cf2 --- /dev/null +++ b/desmume/src/Database.h @@ -0,0 +1,10 @@ +#ifndef DESMUME_DATABASE_H_ +#define DESMUME_DATABASE_H_ + +namespace Database +{ + const char* RegionXXXForCode(char code, bool unknownAsString); + const char* MakerNameForMakerCode(u16 id, bool unknownAsString); +}; + +#endif diff --git a/desmume/src/Makefile.am b/desmume/src/Makefile.am index c74dfabad..5068c1c0e 100644 --- a/desmume/src/Makefile.am +++ b/desmume/src/Makefile.am @@ -18,7 +18,7 @@ libdesmume_a_SOURCES = \ commandline.h commandline.cpp \ common.cpp common.h \ debug.cpp debug.h \ - Disassembler.cpp Disassembler.h \ + Database.cpp Database.h Disassembler.cpp Disassembler.h \ emufile.h emufile.cpp encrypt.h encrypt.cpp FIFO.cpp FIFO.h \ firmware.cpp firmware.h GPU.cpp GPU.h \ GPU_osd.h \ diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 898208e30..72013d84c 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -56,6 +56,7 @@ #include "slot2.h" #include "SPU.h" #include "wifi.h" +#include "Database.h" #ifdef GDB_STUB #include "gdbstub.h" @@ -357,27 +358,7 @@ bool GameInfo::ValidateHeader() void GameInfo::populate() { - const char regions_index[] = "JPFSEODIRKHXVWUC"; - const char *regions[] = { - "???", - "JPN", // J - "EUR", // P - "FRA", // F - "ESP", // S - "USA", // E - "INT", // O - "NOE", // D - "ITA", // I - "RUS", // R - "KOR", // K - "HOL", // H - "EUU", // X - "EUU", // V - "EUU", // W - "AUS", // U - "CHN", // C - }; //set or build as appropriate ROMserial if(isHomebrew()) @@ -393,13 +374,8 @@ void GameInfo::populate() strcpy(ROMserial,"NTR- -"); memcpy(ROMserial+4, header.gameCode, 4); - u32 regions_num = ARRAY_SIZE(regions); - u32 region = (u32)(std::max(strchr(regions_index,header.gameCode[3]) - regions_index + 1, 0)); - - if (region < regions_num) - strcat(ROMserial, regions[region]); - else - strcat(ROMserial, "???"); + const char* rgn = Database::RegionXXXForCode(header.gameCode[3],true); + strcat(ROMserial, rgn); } //rom name is probably set even in homebrew, so do it regardless @@ -751,7 +727,9 @@ int NDS_LoadROM(const char *filename, const char *physicalName, const char *logi INFO("ROM internal name: %s\n", gameInfo.ROMname); if (gameInfo.isDSiEnhanced()) INFO("ROM DSi Enhanced\n"); } - INFO("ROM developer: %s\n", ((gameInfo.header.makerCode == 0) && gameInfo.isHomebrew())?"Homebrew":getDeveloperNameByID(gameInfo.header.makerCode).c_str()); + + const char *makerName = Database::MakerNameForMakerCode(gameInfo.header.makerCode,true); + INFO("ROM developer: %s\n", ((gameInfo.header.makerCode == 0) && gameInfo.isHomebrew())?"Homebrew":makerName); buf[0] = gameInfo.header.gameCode[0]; buf[1] = gameInfo.header.gameCode[1]; diff --git a/desmume/src/common.cpp b/desmume/src/common.cpp index 985425bdd..d8e2cde1c 100644 --- a/desmume/src/common.cpp +++ b/desmume/src/common.cpp @@ -32,329 +32,6 @@ static std::map _alignedPtrList; // Key: Aligned pointer / Value: Original pointer -static MAKER makerCodes[] = { - { 0x3130, "Nintendo" }, - { 0x3230, "Rocket Games, Ajinomoto" }, - { 0x3330, "Imagineer-Zoom" }, - { 0x3430, "Gray Matter?" }, - { 0x3530, "Zamuse" }, - { 0x3630, "Falcom" }, - { 0x3730, "Enix?" }, - { 0x3830, "Capcom" }, - { 0x3930, "Hot B Co." }, - { 0x4130, "Jaleco" }, - { 0x4230, "Coconuts Japan" }, - { 0x4330, "Coconuts Japan/G.X.Media" }, - { 0x4430, "Micronet?" }, - { 0x4530, "Technos" }, - { 0x4630, "Mebio Software" }, - { 0x4730, "Shouei System" }, - { 0x4830, "Starfish" }, - { 0x4A30, "Mitsui Fudosan/Dentsu" }, - { 0x4C30, "Warashi Inc." }, - { 0x4E30, "Nowpro" }, - { 0x5030, "Game Village" }, - { 0x3031, "?????????????" }, - { 0x3231, "Infocom" }, - { 0x3331, "Electronic Arts Japan" }, - { 0x3531, "Cobra Team" }, - { 0x3631, "Human/Field" }, - { 0x3731, "KOEI" }, - { 0x3831, "Hudson Soft" }, - { 0x3931, "S.C.P." }, - { 0x4131, "Yanoman" }, - { 0x4331, "Tecmo Products" }, - { 0x4431, "Japan Glary Business" }, - { 0x4531, "Forum/OpenSystem" }, - { 0x4631, "Virgin Games" }, - { 0x4731, "SMDE" }, - { 0x4A31, "Daikokudenki" }, - { 0x5031, "Creatures Inc." }, - { 0x5131, "TDK Deep Impresion" }, - { 0x3032, "Destination Software, KSS" }, - { 0x3132, "Sunsoft/Tokai Engineering??" }, - { 0x3232, "POW, VR 1 Japan??" }, - { 0x3332, "Micro World" }, - { 0x3532, "San-X" }, - { 0x3632, "Enix" }, - { 0x3732, "Loriciel/Electro Brain" }, - { 0x3832, "Kemco Japan" }, - { 0x3932, "Seta" }, - { 0x4132, "Culture Brain" }, - { 0x4332, "Palsoft" }, - { 0x4432, "Visit Co.,Ltd." }, - { 0x4532, "Intec" }, - { 0x4632, "System Sacom" }, - { 0x4732, "Poppo" }, - { 0x4832, "Ubisoft Japan" }, - { 0x4A32, "Media Works" }, - { 0x4B32, "NEC InterChannel" }, - { 0x4C32, "Tam" }, - { 0x4D32, "Jordan" }, - { 0x4E32, "Smilesoft ???, Rocket ???" }, - { 0x5132, "Mediakite" }, - { 0x3033, "Viacom" }, - { 0x3133, "Carrozzeria" }, - { 0x3233, "Dynamic" }, - { 0x3433, "Magifact" }, - { 0x3533, "Hect" }, - { 0x3633, "Codemasters" }, - { 0x3733, "Taito/GAGA Communications" }, - { 0x3833, "Laguna" }, - { 0x3933, "Telstar Fun & Games, Event/Taito" }, - { 0x4233, "Arcade Zone Ltd" }, - { 0x4333, "Entertainment International/Empire Software?" }, - { 0x4433, "Loriciel" }, - { 0x4533, "Gremlin Graphics" }, - { 0x4633, "K.Amusement Leasing Co." }, - { 0x3034, "Seika Corp." }, - { 0x3134, "Ubi Soft Entertainment" }, - { 0x3234, "Sunsoft US?" }, - { 0x3434, "Life Fitness" }, - { 0x3634, "System 3" }, - { 0x3734, "Spectrum Holobyte" }, - { 0x3934, "IREM" }, - { 0x4234, "Raya Systems" }, - { 0x4334, "Renovation Products" }, - { 0x4434, "Malibu Games" }, - { 0x4634, "Eidos (was U.S. Gold <=1995)" }, - { 0x4734, "Playmates Interactive?" }, - { 0x4A34, "Fox Interactive" }, - { 0x4B34, "Time Warner Interactive" }, - { 0x5134, "Disney Interactive" }, - { 0x5334, "Black Pearl" }, - { 0x5534, "Advanced Productions" }, - { 0x5834, "GT Interactive" }, - { 0x5934, "RARE?" }, - { 0x5A34, "Crave Entertainment" }, - { 0x3035, "Absolute Entertainment" }, - { 0x3135, "Acclaim" }, - { 0x3235, "Activision" }, - { 0x3335, "American Sammy" }, - { 0x3435, "Take 2 Interactive (before it was GameTek)" }, - { 0x3535, "Hi Tech" }, - { 0x3635, "LJN LTD." }, - { 0x3835, "Mattel" }, - { 0x4135, "Mindscape, Red Orb Entertainment?" }, - { 0x4235, "Romstar" }, - { 0x4335, "Taxan" }, - { 0x4435, "Midway (before it was Tradewest)" }, - { 0x4635, "American Softworks" }, - { 0x4735, "Majesco Sales Inc" }, - { 0x4835, "3DO" }, - { 0x4B35, "Hasbro" }, - { 0x4C35, "NewKidCo" }, - { 0x4D35, "Telegames" }, - { 0x4E35, "Metro3D" }, - { 0x5035, "Vatical Entertainment" }, - { 0x5135, "LEGO Media" }, - { 0x5335, "Xicat Interactive" }, - { 0x5435, "Cryo Interactive" }, - { 0x5735, "Red Storm Entertainment" }, - { 0x5835, "Microids" }, - { 0x5A35, "Conspiracy/Swing" }, - { 0x3036, "Titus" }, - { 0x3136, "Virgin Interactive" }, - { 0x3236, "Maxis" }, - { 0x3436, "LucasArts Entertainment" }, - { 0x3736, "Ocean" }, - { 0x3936, "Electronic Arts" }, - { 0x4236, "Laser Beam" }, - { 0x4536, "Elite Systems" }, - { 0x4636, "Electro Brain" }, - { 0x4736, "The Learning Company" }, - { 0x4836, "BBC" }, - { 0x4A36, "Software 2000" }, - { 0x4C36, "BAM! Entertainment" }, - { 0x4D36, "Studio 3" }, - { 0x5136, "Classified Games" }, - { 0x5336, "TDK Mediactive" }, - { 0x5536, "DreamCatcher" }, - { 0x5636, "JoWood Produtions" }, - { 0x5736, "SEGA" }, - { 0x5836, "Wannado Edition" }, - { 0x5936, "LSP" }, - { 0x5A36, "ITE Media" }, - { 0x3037, "Infogrames" }, - { 0x3137, "Interplay" }, - { 0x3237, "JVC" }, - { 0x3337, "Parker Brothers" }, - { 0x3537, "Sales Curve" }, - { 0x3837, "THQ" }, - { 0x3937, "Accolade" }, - { 0x4137, "Triffix Entertainment" }, - { 0x4337, "Microprose Software" }, - { 0x4437, "Universal Interactive, Sierra, Simon & Schuster?" }, - { 0x4637, "Kemco" }, - { 0x4737, "Rage Software" }, - { 0x4837, "Encore" }, - { 0x4A37, "Zoo" }, - { 0x4B37, "BVM" }, - { 0x4C37, "Simon & Schuster Interactive" }, - { 0x4D37, "Asmik Ace Entertainment Inc./AIA" }, - { 0x4E37, "Empire Interactive?" }, - { 0x5137, "Jester Interactive" }, - { 0x5437, "Scholastic" }, - { 0x5537, "Ignition Entertainment" }, - { 0x5737, "Stadlbauer" }, - { 0x3038, "Misawa" }, - { 0x3138, "Teichiku" }, - { 0x3238, "Namco Ltd." }, - { 0x3338, "LOZC" }, - { 0x3438, "KOEI" }, - { 0x3638, "Tokuma Shoten Intermedia" }, - { 0x3738, "Tsukuda Original" }, - { 0x3838, "DATAM-Polystar" }, - { 0x4238, "Bulletproof Software" }, - { 0x4338, "Vic Tokai Inc." }, - { 0x4538, "Character Soft" }, - { 0x4638, "I'Max" }, - { 0x4738, "Saurus" }, - { 0x4A38, "General Entertainment" }, - { 0x4E38, "Success" }, - { 0x5038, "SEGA Japan" }, - { 0x3039, "Takara Amusement" }, - { 0x3139, "Chun Soft" }, - { 0x3239, "Video System, McO'River???" }, - { 0x3339, "BEC" }, - { 0x3539, "Varie" }, - { 0x3639, "Yonezawa/S'pal" }, - { 0x3739, "Kaneko" }, - { 0x3939, "Victor Interactive Software, Pack in Video" }, - { 0x4139, "Nichibutsu/Nihon Bussan" }, - { 0x4239, "Tecmo" }, - { 0x4339, "Imagineer" }, - { 0x4639, "Nova" }, - { 0x4739, "Den'Z" }, - { 0x4839, "Bottom Up" }, - { 0x4A39, "TGL" }, - { 0x4C39, "Hasbro Japan?" }, - { 0x4E39, "Marvelous Entertainment" }, - { 0x5039, "Keynet Inc." }, - { 0x5139, "Hands-On Entertainment" }, - { 0x3041, "Telenet" }, - { 0x3141, "Hori" }, - { 0x3441, "Konami" }, - { 0x3541, "K.Amusement Leasing Co." }, - { 0x3641, "Kawada" }, - { 0x3741, "Takara" }, - { 0x3941, "Technos Japan Corp." }, - { 0x4141, "JVC, Victor Musical Indutries" }, - { 0x4341, "Toei Animation" }, - { 0x4441, "Toho" }, - { 0x4641, "Namco" }, - { 0x4741, "Media Rings Corporation" }, - { 0x4841, "J-Wing" }, - { 0x4A41, "Pioneer LDC" }, - { 0x4B41, "KID" }, - { 0x4C41, "Mediafactory" }, - { 0x5041, "Infogrames Hudson" }, - { 0x5141, "Kiratto. Ludic Inc" }, - { 0x3042, "Acclaim Japan" }, - { 0x3142, "ASCII (was Nexoft?)" }, - { 0x3242, "Bandai" }, - { 0x3442, "Enix" }, - { 0x3642, "HAL Laboratory" }, - { 0x3742, "SNK" }, - { 0x3942, "Pony Canyon" }, - { 0x4142, "Culture Brain" }, - { 0x4242, "Sunsoft" }, - { 0x4342, "Toshiba EMI" }, - { 0x4442, "Sony Imagesoft" }, - { 0x4642, "Sammy" }, - { 0x4742, "Magical" }, - { 0x4842, "Visco" }, - { 0x4A42, "Compile " }, - { 0x4C42, "MTO Inc." }, - { 0x4E42, "Sunrise Interactive" }, - { 0x5042, "Global A Entertainment" }, - { 0x5142, "Fuuki" }, - { 0x3043, "Taito" }, - { 0x3243, "Kemco" }, - { 0x3343, "Square" }, - { 0x3443, "Tokuma Shoten" }, - { 0x3543, "Data East" }, - { 0x3643, "Tonkin House (was Tokyo Shoseki)" }, - { 0x3843, "Koei" }, - { 0x4143, "Konami/Ultra/Palcom" }, - { 0x4243, "NTVIC/VAP" }, - { 0x4343, "Use Co.,Ltd." }, - { 0x4443, "Meldac" }, - { 0x4543, "Pony Canyon" }, - { 0x4643, "Angel, Sotsu Agency/Sunrise" }, - { 0x4A43, "Boss" }, - { 0x4743, "Yumedia/Aroma Co., Ltd" }, - { 0x4B43, "Axela/Crea-Tech?" }, - { 0x4C43, "Sekaibunka-Sha, Sumire kobo?, Marigul Management Inc.?" }, - { 0x4D43, "Konami Computer Entertainment Osaka" }, - { 0x5043, "Enterbrain" }, - { 0x3044, "Taito/Disco" }, - { 0x3144, "Sofel" }, - { 0x3244, "Quest, Bothtec" }, - { 0x3344, "Sigma, ?????" }, - { 0x3444, "Ask Kodansha" }, - { 0x3644, "Naxat" }, - { 0x3744, "Copya System" }, - { 0x3844, "Capcom Co., Ltd." }, - { 0x3944, "Banpresto" }, - { 0x4144, "TOMY" }, - { 0x4244, "LJN Japan" }, - { 0x4444, "NCS" }, - { 0x4544, "Human Entertainment" }, - { 0x4644, "Altron" }, - { 0x4744, "Jaleco???" }, - { 0x4844, "Gaps Inc." }, - { 0x4C44, "????" }, - { 0x4E44, "Elf" }, - { 0x3045, "Jaleco" }, - { 0x3145, "????" }, - { 0x3245, "Yutaka" }, - { 0x3345, "Varie" }, - { 0x3445, "T&ESoft" }, - { 0x3545, "Epoch" }, - { 0x3745, "Athena" }, - { 0x3845, "Asmik" }, - { 0x3945, "Natsume" }, - { 0x4145, "King Records" }, - { 0x4245, "Atlus" }, - { 0x4345, "Epic/Sony Records" }, - { 0x4545, "IGS" }, - { 0x4745, "Chatnoir" }, - { 0x4845, "Right Stuff" }, - { 0x4C45, "Spike" }, - { 0x4D45, "Konami Computer Entertainment Tokyo" }, - { 0x4E45, "Alphadream Corporation" }, - { 0x3046, "A Wave" }, - { 0x3146, "Motown Software" }, - { 0x3246, "Left Field Entertainment" }, - { 0x3346, "Extreme Ent. Grp." }, - { 0x3446, "TecMagik" }, - { 0x3946, "Cybersoft" }, - { 0x4246, "Psygnosis" }, - { 0x4546, "Davidson/Western Tech." }, - { 0x3147, "PCCW Japan" }, - { 0x3447, "KiKi Co Ltd" }, - { 0x3547, "Open Sesame Inc???" }, - { 0x3647, "Sims" }, - { 0x3747, "Broccoli" }, - { 0x3847, "Avex" }, - { 0x3947, "D3 Publisher" }, - { 0x4247, "Konami Computer Entertainment Japan" }, - { 0x4447, "Square-Enix" }, - { 0x4849, "Yojigen" }, -}; - -std::string getDeveloperNameByID(u16 id) -{ - u32 i; - for (i = 0; i < ARRAY_SIZE(makerCodes); i++) - { - if (makerCodes[i].code == id) - return makerCodes[i].name; - } - return "Unknown"; -} - // =============================================================================== // Message dialogs // =============================================================================== diff --git a/desmume/src/common.h b/desmume/src/common.h index ea23baed3..4f7bd974c 100644 --- a/desmume/src/common.h +++ b/desmume/src/common.h @@ -42,14 +42,7 @@ extern msgBoxInterface *msgbox; // =============================================================================== // Maker codes // =============================================================================== - -struct MAKER -{ - u16 code; - const char* name; -}; - -std::string getDeveloperNameByID(u16 id); +// void* malloc_aligned(size_t length, size_t alignment); void* malloc_aligned16(size_t length); diff --git a/desmume/src/saves.cpp b/desmume/src/saves.cpp index 558b6f191..6983c7cf9 100644 --- a/desmume/src/saves.cpp +++ b/desmume/src/saves.cpp @@ -1129,9 +1129,7 @@ static bool ReadStateChunks(EMUFILE* is, s32 totalsize) if (haveInfo) { - char buf[14] = {0}; - memset(&buf[0], 0, sizeof(buf)); - memcpy(buf, header.gameTile, sizeof(header.gameTile)); + printf("Savestate info:\n"); if (version_major | version_minor | version_build) { @@ -1147,14 +1145,19 @@ static bool ReadStateChunks(EMUFILE* is, s32 totalsize) DateTime tm = save_time; printf("\tSave created: %04d-%03s-%02d %s %02d:%02d:%02d\n", tm.get_Year(), DateTime::GetNameOfMonth(tm.get_Month()), tm.get_Day(), wday[tm.get_DayOfWeek()%7], tm.get_Hour(), tm.get_Minute(), tm.get_Second()); } - printf("\tGame title: %s\n", buf); - printf("\tGame code: %c%c%c%c\n", header.gameCode[0], header.gameCode[1], header.gameCode[2], header.gameCode[3]); - printf("\tMaker code: %c%c (0x%04X) - %s\n", header.makerCode & 0xFF, header.makerCode >> 8, header.makerCode, getDeveloperNameByID(header.makerCode).c_str()); - printf("\tDevice capacity: %dMb (real size %dMb)\n", ((128 * 1024) << header.cardSize) / (1024 * 1024), romsize / (1024 * 1024)); - printf("\tCRC16: %04Xh\n", header.CRC16); - printf("\tHeader CRC16: %04Xh\n", header.headerCRC16); - printf("\tSlot1: %s\n", slot1_List[slot1Type]->info()->name()); - printf("\tSlot2: %s\n", slot2_List[slot2Type]->info()->name()); + + //nope. create a common method elsewhere for printing this. + //char buf[14] = {0}; + //memset(&buf[0], 0, sizeof(buf)); + //memcpy(buf, header.gameTile, sizeof(header.gameTile)); + //printf("\tGame title: %s\n", buf); + //printf("\tGame code: %c%c%c%c\n", header.gameCode[0], header.gameCode[1], header.gameCode[2], header.gameCode[3]); + //const char *makerName = Database::MakerNameForMakerCode(header.makerCode); + //makerName = makerName ? makerName : "Unknown"; + //printf("\tMaker code: %c%c (0x%04X) - %s\n", header.makerCode & 0xFF, header.makerCode >> 8, header.makerCode, makerName); + //printf("\tDevice capacity: %dMb (real size %dMb)\n", ((128 * 1024) << header.cardSize) / (1024 * 1024), romsize / (1024 * 1024)); + //printf("\tCRC16: %04Xh\n", header.CRC16); + //printf("\tHeader CRC16: %04Xh\n", header.headerCRC16); if (gameInfo.romsize != romsize || memcmp(&gameInfo.header, &header, sizeof(header)) != 0) msgbox->warn("The savestate you are loading does not match the ROM you are running.\nYou should find the correct ROM"); diff --git a/desmume/src/windows/DeSmuME.vcxproj b/desmume/src/windows/DeSmuME.vcxproj index ee30d47d6..a26b63179 100644 --- a/desmume/src/windows/DeSmuME.vcxproj +++ b/desmume/src/windows/DeSmuME.vcxproj @@ -79,6 +79,7 @@ + @@ -351,6 +352,7 @@ + @@ -694,4 +696,4 @@ - + \ No newline at end of file diff --git a/desmume/src/windows/DeSmuME.vcxproj.filters b/desmume/src/windows/DeSmuME.vcxproj.filters index 2e317d9d3..27eb62b95 100644 --- a/desmume/src/windows/DeSmuME.vcxproj.filters +++ b/desmume/src/windows/DeSmuME.vcxproj.filters @@ -121,6 +121,9 @@ {18cba3ce-aaa6-441d-8111-408d0fcef7d2} + + {37e11fb9-8dec-43bd-8242-a721d69a740f} + @@ -447,9 +450,6 @@ Core\utils\libfat - - Core\utils\libfat - Core\utils\libfat @@ -966,6 +966,15 @@ Core\libretro-common\file + + Core\utils\libfat + + + Core\libretro-common\features + + + Core + @@ -1721,9 +1730,6 @@ Core\frontend\modules - - Core\libretro-common\formats\png - Core\libretro-common\include\formats @@ -1739,6 +1745,9 @@ Core\libretro-common\include\compat + + Core + diff --git a/desmume/src/windows/ginfo.cpp b/desmume/src/windows/ginfo.cpp index 75f2add68..392ea4232 100644 --- a/desmume/src/windows/ginfo.cpp +++ b/desmume/src/windows/ginfo.cpp @@ -28,6 +28,7 @@ #include "resource.h" #include "FirmConfig.h" #include "main.h" +#include "Database.h" ////////////////////////////////////////////////////////////////////////////// @@ -117,14 +118,12 @@ LRESULT GInfo_Paint(HWND hDlg, WPARAM wParam, LPARAM lParam) text[12] = '\0'; SetWindowText(GetDlgItem(hDlg, IDC_GI_GAMETITLE), text); - memcpy(text, ((u8*)&gameInfo.header+0xC), 4); - text[4] = '\0'; - SetWindowText(GetDlgItem(hDlg, IDC_GI_GAMECODE), text); + SetDlgItemText(hDlg, IDC_GI_GAMECODE, gameInfo.ROMserial); memcpy(text, ((u8*)&gameInfo.header+0x10), 2); text[2] = '\0'; SetWindowText(GetDlgItem(hDlg, IDC_GI_MAKERCODE), text); - SetWindowText(GetDlgItem(hDlg, IDC_SDEVELOPER), getDeveloperNameByID(T1ReadWord((u8*)&gameInfo.header, 0x10)).c_str()); + SetWindowText(GetDlgItem(hDlg, IDC_SDEVELOPER), Database::MakerNameForMakerCode(T1ReadWord((u8*)&gameInfo.header, 0x10),true)); val = T1ReadByte((u8*)&gameInfo.header, 0x14); sprintf(text, "%i kilobytes", (0x80 << val)); diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index aaabebd3a..d1d381358 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -3036,7 +3036,7 @@ int _main() if(CommonSettings.single_core()) SetProcessAffinityMask(GetCurrentProcess(),1); - MainWindow = new WINCLASS(CLASSNAME, hAppInst); + MainWindow = new WINCLASS("DeSmuME", hAppInst); if (!MainWindow->create((char*)EMU_DESMUME_NAME_AND_VERSION(), WndX, WndY, video.width,video.height+video.screengap, WS_CAPTION | WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, NULL))