mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-06 14:19:19 +01:00
byuu says: Changelog: - added Cocoa target: higan can now be compiled for OS X Lion [Cydrak, byuu] - SNES/accuracy profile hires color blending improvements - fixes Marvelous text [AWJ] - fixed a slight bug in SNES/SA-1 VBR support caused by a typo - added support for multi-pass shaders that can load external textures (requires OpenGL 3.2+) - added game library path (used by ananke->Import Game) to Settings->Advanced - system profiles, shaders and cheats database can be stored in "all users" shared folders now (eg /usr/share on Linux) - all configuration files are in BML format now, instead of XML (much easier to read and edit this way) - main window supports drag-and-drop of game folders (but not game files / ZIP archives) - audio buffer clears when entering a modal loop on Windows (prevents audio repetition with DirectSound driver) - a substantial amount of code clean-up (probably the biggest refactoring to date) One highly desired target for this release was to default to the optimal drivers instead of the safest drivers, but because AMD drivers don't seem to like my OpenGL 3.2 driver, I've decided to postpone that. AMD has too big a market share. Hopefully with v093 officially released, we can get some public input on what AMD doesn't like.
91 lines
2.8 KiB
C++
91 lines
2.8 KiB
C++
void Ananke::copySufamiTurboSaves(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"});
|
|
}
|
|
}
|
|
}
|
|
|
|
string Ananke::createSufamiTurboDatabase(vector<uint8_t> &buffer, Markup::Node &document, const string &manifest) {
|
|
string pathname = {
|
|
libraryPath, "Sufami Turbo/",
|
|
document["release/information/name"].text(),
|
|
" (", document["release/information/region"].text(), ")",
|
|
" (", document["release/information/revision"].text(), ")",
|
|
".st/"
|
|
};
|
|
directory::create(pathname);
|
|
|
|
//strip "release" root node from database entry (since a single game manifest isn't part of a database)
|
|
string markup = manifest;
|
|
markup.replace("\n ", "\n");
|
|
markup.replace("information", "\ninformation");
|
|
markup.ltrim<1>("release\n");
|
|
|
|
file::write({pathname, "manifest.bml"}, markup);
|
|
file::write({pathname, "program.rom"}, buffer);
|
|
copySufamiTurboSaves(pathname);
|
|
|
|
return pathname;
|
|
}
|
|
|
|
string Ananke::createSufamiTurboHeuristic(vector<uint8_t> &buffer) {
|
|
string pathname = {
|
|
libraryPath, "Sufami Turbo/",
|
|
nall::basename(information.name),
|
|
".st/"
|
|
};
|
|
directory::create(pathname);
|
|
|
|
file::write({pathname, "manifest.bml"}, {
|
|
"unverified\n",
|
|
"\n",
|
|
"cartridge\n",
|
|
" rom name=program.rom size=0x", hex(buffer.size()), "\n",
|
|
" ram name=save.ram size=0x2000\n",
|
|
"\n",
|
|
"information\n",
|
|
" title: ", nall::basename(information.name), "\n"
|
|
});
|
|
file::write({pathname, "program.rom"}, buffer);
|
|
copySufamiTurboSaves(pathname);
|
|
|
|
return pathname;
|
|
}
|
|
|
|
string Ananke::openSufamiTurbo(vector<uint8_t> &buffer) {
|
|
string sha256 = nall::sha256(buffer.data(), buffer.size());
|
|
|
|
string databaseText = string::read({configpath(), "ananke/database/Sufami Turbo.bml"}).strip();
|
|
if(databaseText.empty()) databaseText = string{Database::SufamiTurbo}.strip();
|
|
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 createSufamiTurboDatabase(buffer, document, item);
|
|
}
|
|
}
|
|
|
|
return createSufamiTurboHeuristic(buffer);
|
|
}
|
|
|
|
string Ananke::syncSufamiTurbo(const string &pathname) {
|
|
auto buffer = file::read({pathname, "program.rom"});
|
|
if(buffer.size() == 0) return "";
|
|
|
|
auto save = file::read({pathname, "save.ram"});
|
|
if(save.size() == 0) save = file::read({pathname, "save.rwm"});
|
|
|
|
directory::remove(pathname);
|
|
information.path = pathname;
|
|
information.name = notdir(string{pathname}.rtrim<1>("/"));
|
|
string outputPath = openSufamiTurbo(buffer);
|
|
|
|
if(save.size()) file::write({outputPath, "save.ram"}, save);
|
|
|
|
return outputPath;
|
|
}
|