Update to ananke v00r02 release.
byuu says:
This should be basically final now.
Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips
headers, can use internal or external firmware, imports saves on first
run.
Added a custom file dialog. It seems both GTK+ and Windows XP have
(un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before
"ActRaiser (NA)". So, screw 'em.
2012-12-24 05:48:23 +00:00
|
|
|
void Ananke::copySuperFamicomSaves(const string &pathname) {
|
|
|
|
if(!file::exists({pathname, "save.ram"})) {
|
|
|
|
if(file::exists({information.path, nall::basename(information.name), ".srm"})) {
|
|
|
|
file::copy({information.path, nall::basename(information.name), ".srm"}, {pathname, "save.ram"});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!file::exists({pathname, "rtc.ram"})) {
|
|
|
|
if(file::exists({information.path, nall::basename(information.name), ".rtc"})) {
|
|
|
|
file::copy({information.path, nall::basename(information.name), ".rtc"}, {pathname, "rtc.ram"});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-22 10:28:01 +00:00
|
|
|
string Ananke::createSuperFamicomDatabase(vector<uint8_t> &buffer, Markup::Node &document, const string &manifest) {
|
|
|
|
string pathname = {
|
2013-01-21 12:27:15 +00:00
|
|
|
libraryPath, "Super Famicom/",
|
2012-11-22 10:28:01 +00:00
|
|
|
document["release/information/name"].text(),
|
|
|
|
" (", document["release/information/region"].text(), ")",
|
|
|
|
" (", document["release/information/revision"].text(), ")",
|
|
|
|
".sfc/"
|
|
|
|
};
|
|
|
|
directory::create(pathname);
|
|
|
|
|
Update to ananke v00r02 release.
byuu says:
This should be basically final now.
Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips
headers, can use internal or external firmware, imports saves on first
run.
Added a custom file dialog. It seems both GTK+ and Windows XP have
(un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before
"ActRaiser (NA)". So, screw 'em.
2012-12-24 05:48:23 +00:00
|
|
|
//strip "release" root node from database entry (since a single game manifest isn't part of a database)
|
2012-11-22 10:28:01 +00:00
|
|
|
string markup = manifest;
|
|
|
|
markup.replace("\n ", "\n");
|
|
|
|
markup.replace("information", "\ninformation");
|
|
|
|
markup.ltrim<1>("release\n");
|
|
|
|
|
|
|
|
file::write({pathname, "manifest.bml"}, markup);
|
|
|
|
|
|
|
|
unsigned offset = 0;
|
|
|
|
for(auto &node : document["release/information/configuration"]) {
|
|
|
|
if(node.name != "rom") continue;
|
|
|
|
string name = node["name"].text();
|
|
|
|
unsigned size = node["size"].decimal();
|
|
|
|
file::write({pathname, name}, buffer.data() + offset, size);
|
|
|
|
offset += size;
|
|
|
|
}
|
|
|
|
|
Update to ananke v00r02 release.
byuu says:
This should be basically final now.
Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips
headers, can use internal or external firmware, imports saves on first
run.
Added a custom file dialog. It seems both GTK+ and Windows XP have
(un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before
"ActRaiser (NA)". So, screw 'em.
2012-12-24 05:48:23 +00:00
|
|
|
copySuperFamicomSaves(pathname);
|
2012-11-22 10:28:01 +00:00
|
|
|
return pathname;
|
|
|
|
}
|
|
|
|
|
|
|
|
string Ananke::createSuperFamicomHeuristic(vector<uint8_t> &buffer) {
|
|
|
|
string pathname = {
|
2013-01-21 12:27:15 +00:00
|
|
|
libraryPath, "Super Famicom/",
|
2012-11-22 10:28:01 +00:00
|
|
|
nall::basename(information.name),
|
2013-01-21 12:27:15 +00:00
|
|
|
".sfc/"
|
2012-11-22 10:28:01 +00:00
|
|
|
};
|
|
|
|
directory::create(pathname);
|
2013-01-21 12:27:15 +00:00
|
|
|
file::create({pathname, "unverified"});
|
2012-11-22 10:28:01 +00:00
|
|
|
|
|
|
|
if((buffer.size() & 0x7fff) == 512) buffer.remove(0, 512); //strip copier header, if present
|
|
|
|
|
|
|
|
SuperFamicomCartridge info(buffer.data(), buffer.size());
|
|
|
|
string markup = info.markup;
|
Update to higan v091r14 and ananke v00r03 releases.
byuu says:
higan changelog:
- generates title displayed in emulator window by asking the core
- core builds title solely from "information/title" ... if it's not
there, you don't get a title at all
- sub-system load menu is gone ... since there are multiple revisions of
the SGB, this never really worked well anyway
- to load an SGB, BS-X or ST cartridge, load the base cartridge first
- "File->Load Game" moved to "Load->Import Game" ... may cause a bit of
confusion to new users, but I don't like having a single-item menu,
we'll just have to explain it to new users
- browser window redone to look like ananke
- home button here goes to ~/Emulation rather than just ~ like ananke,
since this is the home of game folders
- game folder icon is now the executable icon for the Tango theme
(orange diamond), meant to represent a complete game rather than
a game file or archive
ananke changelog:
- outputs GBC games to "Game Boy Color/" instead of "Game Boy/"
- adds the file basename to "information/title"
Known issues:
- using ananke to load a GB game trips the Super Famicom SGB mode and
fails (need to make the full-path auto-detection ignore non-bootable
systems)
- need to dump and test some BS-X media before releasing
- ananke lacks BS-X Satellaview cartridge support
- v092 isn't going to let you retarget the ananke/higan game folder path
of ~/Emulation, you will have to wait for a future version if that
bothers you so greatly
[Later, after the v092 release, byuu posted this additional changelog:
- kill laevateinn
- add title()
- add bootable, remove load
- combine file, library
- combine [][][] paths
- fix SFC subtype handling XML->BML
- update file browser to use buttons
- update file browser keyboard handling
- update system XML->BML
- fix sufami turbo hashing
- remove Cartridge::manifest
]
2012-12-25 05:31:55 +00:00
|
|
|
markup.append("\ninformation\n title: ", nall::basename(information.name), "\n");
|
2012-11-22 10:28:01 +00:00
|
|
|
if(!information.manifest.empty()) markup = information.manifest; //override with embedded beat manifest, if one exists
|
Update to ananke v00r02 release.
byuu says:
This should be basically final now.
Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips
headers, can use internal or external firmware, imports saves on first
run.
Added a custom file dialog. It seems both GTK+ and Windows XP have
(un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before
"ActRaiser (NA)". So, screw 'em.
2012-12-24 05:48:23 +00:00
|
|
|
information.manifest = markup; //save for use with firmware routine below
|
2012-11-22 10:28:01 +00:00
|
|
|
|
|
|
|
file::write({pathname, "manifest.bml"}, markup);
|
|
|
|
|
|
|
|
if(!markup.position("spc7110")) {
|
Update to ananke v00r02 release.
byuu says:
This should be basically final now.
Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips
headers, can use internal or external firmware, imports saves on first
run.
Added a custom file dialog. It seems both GTK+ and Windows XP have
(un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before
"ActRaiser (NA)". So, screw 'em.
2012-12-24 05:48:23 +00:00
|
|
|
file::write({pathname, "program.rom"}, buffer.data(), info.rom_size);
|
2012-11-22 10:28:01 +00:00
|
|
|
} else {
|
|
|
|
file::write({pathname, "program.rom"}, buffer.data(), 0x100000);
|
Update to ananke v00r02 release.
byuu says:
This should be basically final now.
Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips
headers, can use internal or external firmware, imports saves on first
run.
Added a custom file dialog. It seems both GTK+ and Windows XP have
(un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before
"ActRaiser (NA)". So, screw 'em.
2012-12-24 05:48:23 +00:00
|
|
|
file::write({pathname, "data.rom"}, buffer.data() + 0x100000, info.rom_size - 0x100000);
|
2012-11-22 10:28:01 +00:00
|
|
|
}
|
|
|
|
|
Update to ananke v00r02 release.
byuu says:
This should be basically final now.
Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips
headers, can use internal or external firmware, imports saves on first
run.
Added a custom file dialog. It seems both GTK+ and Windows XP have
(un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before
"ActRaiser (NA)". So, screw 'em.
2012-12-24 05:48:23 +00:00
|
|
|
createSuperFamicomHeuristicFirmware(buffer, pathname, info.firmware_appended);
|
|
|
|
copySuperFamicomSaves(pathname);
|
|
|
|
|
|
|
|
return pathname;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Ananke::createSuperFamicomHeuristicFirmware(vector<uint8_t> &buffer, const string &pathname, bool firmware_appended) {
|
2013-01-15 10:51:49 +00:00
|
|
|
auto copyFirmwareInternal = [&](const string &name, unsigned programSize, unsigned dataSize, unsigned bootSize) {
|
Update to ananke v00r02 release.
byuu says:
This should be basically final now.
Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips
headers, can use internal or external firmware, imports saves on first
run.
Added a custom file dialog. It seems both GTK+ and Windows XP have
(un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before
"ActRaiser (NA)". So, screw 'em.
2012-12-24 05:48:23 +00:00
|
|
|
//firmware appended directly onto .sfc file
|
|
|
|
string basename = nall::basename(name);
|
2013-01-15 10:51:49 +00:00
|
|
|
if(programSize) file::write({pathname, basename, ".program.rom"}, buffer.data() + buffer.size() - programSize - dataSize - bootSize, programSize);
|
|
|
|
if(dataSize) file::write({pathname, basename, ".data.rom"}, buffer.data() + buffer.size() - dataSize - bootSize, dataSize);
|
|
|
|
if(bootSize) file::write({pathname, basename, ".boot.rom"}, buffer.data() + buffer.size() - bootSize, bootSize);
|
Update to ananke v00r02 release.
byuu says:
This should be basically final now.
Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips
headers, can use internal or external firmware, imports saves on first
run.
Added a custom file dialog. It seems both GTK+ and Windows XP have
(un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before
"ActRaiser (NA)". So, screw 'em.
2012-12-24 05:48:23 +00:00
|
|
|
};
|
|
|
|
|
2013-01-15 10:51:49 +00:00
|
|
|
auto copyFirmwareExternal = [&](const string &name, unsigned programSize, unsigned dataSize, unsigned bootSize) {
|
Update to ananke v00r02 release.
byuu says:
This should be basically final now.
Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips
headers, can use internal or external firmware, imports saves on first
run.
Added a custom file dialog. It seems both GTK+ and Windows XP have
(un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before
"ActRaiser (NA)". So, screw 'em.
2012-12-24 05:48:23 +00:00
|
|
|
//firmware stored in external file
|
2012-11-22 10:28:01 +00:00
|
|
|
auto buffer = file::read({information.path, name}); //try and read from the containing directory
|
|
|
|
if(buffer.size() == 0) buffer = extractFile(name); //try and read from the containing archive, if one exists
|
|
|
|
if(buffer.size() == 0) {
|
2013-01-21 12:27:15 +00:00
|
|
|
if(thread::primary()) MessageWindow::critical(Window::none(), {
|
|
|
|
"Error: ", information.name, "\n\n",
|
|
|
|
"Required firmware ", name, " not found. Game will not be playable!\n\n",
|
2012-11-22 10:28:01 +00:00
|
|
|
"You must obtain this file, and place it in the same folder as this game."
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
string basename = nall::basename(name);
|
|
|
|
if(programSize) file::write({pathname, basename, ".program.rom"}, buffer.data(), programSize);
|
|
|
|
if(dataSize) file::write({pathname, basename, ".data.rom"}, buffer.data() + programSize, dataSize);
|
2013-01-15 10:51:49 +00:00
|
|
|
if(bootSize) file::write({pathname, basename, ".boot.rom"}, buffer.data() + programSize + dataSize, bootSize);
|
2012-11-22 10:28:01 +00:00
|
|
|
};
|
|
|
|
|
2013-01-15 10:51:49 +00:00
|
|
|
auto copyFirmware = [&](const string &name, unsigned programSize, unsigned dataSize, unsigned bootSize = 0) {
|
|
|
|
if(firmware_appended == 1) copyFirmwareInternal(name, programSize, dataSize, bootSize);
|
|
|
|
if(firmware_appended == 0) copyFirmwareExternal(name, programSize, dataSize, bootSize);
|
Update to ananke v00r02 release.
byuu says:
This should be basically final now.
Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips
headers, can use internal or external firmware, imports saves on first
run.
Added a custom file dialog. It seems both GTK+ and Windows XP have
(un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before
"ActRaiser (NA)". So, screw 'em.
2012-12-24 05:48:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
string markup = information.manifest;
|
2012-11-22 10:28:01 +00:00
|
|
|
if(markup.position("dsp1.program.rom" )) copyFirmware("dsp1.rom", 0x001800, 0x000800);
|
|
|
|
if(markup.position("dsp1b.program.rom")) copyFirmware("dsp1b.rom", 0x001800, 0x000800);
|
|
|
|
if(markup.position("dsp2.program.rom" )) copyFirmware("dsp2.rom", 0x001800, 0x000800);
|
|
|
|
if(markup.position("dsp3.program.rom" )) copyFirmware("dsp3.rom", 0x001800, 0x000800);
|
|
|
|
if(markup.position("dsp4.program.rom" )) copyFirmware("dsp4.rom", 0x001800, 0x000800);
|
|
|
|
if(markup.position("st010.program.rom")) copyFirmware("st010.rom", 0x00c000, 0x001000);
|
|
|
|
if(markup.position("st011.program.rom")) copyFirmware("st011.rom", 0x00c000, 0x001000);
|
|
|
|
if(markup.position("st018.program.rom")) copyFirmware("st018.rom", 0x020000, 0x008000);
|
|
|
|
if(markup.position("cx4.data.rom" )) copyFirmware("cx4.rom", 0x000000, 0x000c00);
|
2013-01-15 10:51:49 +00:00
|
|
|
if(markup.position("sgb.boot.rom" )) copyFirmware("sgb.rom", 0x000000, 0x000000, 0x000100);
|
2012-11-22 10:28:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
string Ananke::openSuperFamicom(vector<uint8_t> &buffer) {
|
|
|
|
string sha256 = nall::sha256(buffer.data(), buffer.size());
|
|
|
|
|
Update to higan v091r14 and ananke v00r03 releases.
byuu says:
higan changelog:
- generates title displayed in emulator window by asking the core
- core builds title solely from "information/title" ... if it's not
there, you don't get a title at all
- sub-system load menu is gone ... since there are multiple revisions of
the SGB, this never really worked well anyway
- to load an SGB, BS-X or ST cartridge, load the base cartridge first
- "File->Load Game" moved to "Load->Import Game" ... may cause a bit of
confusion to new users, but I don't like having a single-item menu,
we'll just have to explain it to new users
- browser window redone to look like ananke
- home button here goes to ~/Emulation rather than just ~ like ananke,
since this is the home of game folders
- game folder icon is now the executable icon for the Tango theme
(orange diamond), meant to represent a complete game rather than
a game file or archive
ananke changelog:
- outputs GBC games to "Game Boy Color/" instead of "Game Boy/"
- adds the file basename to "information/title"
Known issues:
- using ananke to load a GB game trips the Super Famicom SGB mode and
fails (need to make the full-path auto-detection ignore non-bootable
systems)
- need to dump and test some BS-X media before releasing
- ananke lacks BS-X Satellaview cartridge support
- v092 isn't going to let you retarget the ananke/higan game folder path
of ~/Emulation, you will have to wait for a future version if that
bothers you so greatly
[Later, after the v092 release, byuu posted this additional changelog:
- kill laevateinn
- add title()
- add bootable, remove load
- combine file, library
- combine [][][] paths
- fix SFC subtype handling XML->BML
- update file browser to use buttons
- update file browser keyboard handling
- update system XML->BML
- fix sufami turbo hashing
- remove Cartridge::manifest
]
2012-12-25 05:31:55 +00:00
|
|
|
string databaseText = string::read({configpath(), "ananke/database/Super Famicom.bml"}).strip();
|
Update to ananke v00r02 release.
byuu says:
This should be basically final now.
Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips
headers, can use internal or external firmware, imports saves on first
run.
Added a custom file dialog. It seems both GTK+ and Windows XP have
(un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before
"ActRaiser (NA)". So, screw 'em.
2012-12-24 05:48:23 +00:00
|
|
|
if(databaseText.empty()) databaseText = string{Database::SuperFamicom}.strip();
|
2012-11-22 10:28:01 +00:00
|
|
|
lstring databaseItem = databaseText.split("\n\n");
|
|
|
|
|
|
|
|
for(auto &item : databaseItem) {
|
|
|
|
item.append("\n");
|
|
|
|
auto document = Markup::Document(item);
|
|
|
|
|
|
|
|
if(document["release/information/sha256"].text() == sha256) {
|
|
|
|
return createSuperFamicomDatabase(buffer, document, item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return createSuperFamicomHeuristic(buffer);
|
|
|
|
}
|
2013-01-17 11:14:58 +00:00
|
|
|
|
|
|
|
string Ananke::syncSuperFamicom(const string &pathname) {
|
2013-01-21 08:57:04 +00:00
|
|
|
if(file::exists({pathname, "msu1.rom"})) return ""; //cannot update MSU1 games
|
|
|
|
|
2013-01-17 11:14:58 +00:00
|
|
|
vector<uint8_t> buffer;
|
|
|
|
|
|
|
|
auto append = [&](string filename) {
|
|
|
|
filename = {pathname, filename};
|
|
|
|
auto data = file::read(filename);
|
|
|
|
if(data.size() == 0) return; //file does not exist
|
|
|
|
|
|
|
|
unsigned position = buffer.size();
|
|
|
|
buffer.resize(buffer.size() + data.size());
|
|
|
|
memcpy(buffer.data() + position, data.data(), data.size());
|
|
|
|
};
|
|
|
|
|
|
|
|
append("program.rom");
|
|
|
|
append("data.rom");
|
|
|
|
|
|
|
|
append("dsp1.rom");
|
|
|
|
append("dsp1.program.rom");
|
|
|
|
append("dsp1.data.rom");
|
|
|
|
|
|
|
|
append("dsp1b.rom");
|
|
|
|
append("dsp1b.program.rom");
|
|
|
|
append("dsp1b.data.rom");
|
|
|
|
|
|
|
|
append("dsp2.rom");
|
|
|
|
append("dsp2.program.rom");
|
|
|
|
append("dsp2.data.rom");
|
|
|
|
|
|
|
|
append("dsp3.rom");
|
|
|
|
append("dsp3.program.rom");
|
|
|
|
append("dsp3.data.rom");
|
|
|
|
|
|
|
|
append("dsp4.rom");
|
|
|
|
append("dsp4.program.rom");
|
|
|
|
append("dsp4.data.rom");
|
|
|
|
|
|
|
|
append("st010.rom");
|
|
|
|
append("st010.program.rom");
|
|
|
|
append("st010.data.rom");
|
|
|
|
|
|
|
|
append("st011.rom");
|
|
|
|
append("st011.program.rom");
|
|
|
|
append("st011.data.rom");
|
|
|
|
|
|
|
|
append("st018.rom");
|
|
|
|
append("st018.program.rom");
|
|
|
|
append("st018.data.rom");
|
|
|
|
|
|
|
|
append("cx4.rom");
|
|
|
|
append("cx4.data.rom");
|
|
|
|
|
|
|
|
append("sgb.rom");
|
|
|
|
append("sgb.boot.rom");
|
|
|
|
|
|
|
|
if(buffer.size() == 0) return "";
|
|
|
|
|
|
|
|
auto save = file::read({pathname, "save.ram"});
|
|
|
|
if(save.size() == 0) save = file::read({pathname, "save.rwm"});
|
|
|
|
|
|
|
|
auto rtc = file::read({pathname, "rtc.ram"});
|
|
|
|
if(rtc.size() == 0) rtc= file::read({pathname, "rtc.rwm"});
|
|
|
|
|
|
|
|
directory::remove(pathname);
|
2013-01-19 11:23:42 +00:00
|
|
|
information.path = pathname;
|
|
|
|
information.name = notdir(string{pathname}.rtrim<1>("/"));
|
2013-01-17 11:14:58 +00:00
|
|
|
string outputPath = openSuperFamicom(buffer);
|
|
|
|
|
|
|
|
if(save.size()) file::write({outputPath, "save.ram"}, save);
|
|
|
|
if(rtc.size()) file::write({outputPath, "rtc.ram"}, save);
|
|
|
|
|
|
|
|
return outputPath;
|
|
|
|
}
|