Update to v091r11 release.
byuu says:
This release refines HSU1 support as a bidirectional protocol, nests SFC
manifests as "release/cartridge" and "release/information" (but release/
is not guaranteed to be finalized just yet), removes the database
integration, and adds support for ananke.
ananke represents inevitability. It's a library that, when installed,
higan can use to load files from the command-line, and also from a new
File -> Load Game menu option.
I need to change the build rules a bit for it to work on Windows (need
to make phoenix a DLL, basically), but it works now on Linux.
Right now, it only takes *.sfc file names, looks them up in the included
database, converts them to game folders, and returns the game folder
path for higan to load.
The idea is to continue expanding it to support everything we can that
I don't want in the higan core:
- load *.sfc, *.smc, *.swc, *.fig files
- remove SNES copier headers
- split apart merged firmware files
- pull in external firmware files (eg dsp1b.rom - these are staying
merged, just as SPC7110 prg+dat are merged)
- load *.zip and *.7z archives
- prompt for selection on multi-file archives
- generate manifest files based on heuristics
- apply BPS patches
The "Load" menu option has been renamed to "Library", to represent games
in your library. I'm going to add some sort of suffix to indicate
unverified games, and use a different folder icon for those (eg
manifests built on heuristics rather than from the database.)
So basically, to future end users:
File -> Load Game will be how they play games.
Library -> (specific system) can be thought of as an infinitely-sized
recent games list.
purify will likely become a simple stub that invokes ananke's functions.
No reason to duplicate all that code.
2012-11-05 08:22:50 +00:00
|
|
|
#ifndef NALL_BEAT_MULTI_HPP
|
|
|
|
#define NALL_BEAT_MULTI_HPP
|
2012-08-16 10:30:47 +00:00
|
|
|
|
Update to v091r11 release.
byuu says:
This release refines HSU1 support as a bidirectional protocol, nests SFC
manifests as "release/cartridge" and "release/information" (but release/
is not guaranteed to be finalized just yet), removes the database
integration, and adds support for ananke.
ananke represents inevitability. It's a library that, when installed,
higan can use to load files from the command-line, and also from a new
File -> Load Game menu option.
I need to change the build rules a bit for it to work on Windows (need
to make phoenix a DLL, basically), but it works now on Linux.
Right now, it only takes *.sfc file names, looks them up in the included
database, converts them to game folders, and returns the game folder
path for higan to load.
The idea is to continue expanding it to support everything we can that
I don't want in the higan core:
- load *.sfc, *.smc, *.swc, *.fig files
- remove SNES copier headers
- split apart merged firmware files
- pull in external firmware files (eg dsp1b.rom - these are staying
merged, just as SPC7110 prg+dat are merged)
- load *.zip and *.7z archives
- prompt for selection on multi-file archives
- generate manifest files based on heuristics
- apply BPS patches
The "Load" menu option has been renamed to "Library", to represent games
in your library. I'm going to add some sort of suffix to indicate
unverified games, and use a different folder icon for those (eg
manifests built on heuristics rather than from the database.)
So basically, to future end users:
File -> Load Game will be how they play games.
Library -> (specific system) can be thought of as an infinitely-sized
recent games list.
purify will likely become a simple stub that invokes ananke's functions.
No reason to duplicate all that code.
2012-11-05 08:22:50 +00:00
|
|
|
#include <nall/beat/patch.hpp>
|
|
|
|
#include <nall/beat/linear.hpp>
|
|
|
|
#include <nall/beat/delta.hpp>
|
2012-08-16 10:30:47 +00:00
|
|
|
|
|
|
|
namespace nall {
|
|
|
|
|
|
|
|
struct bpsmulti {
|
|
|
|
enum : unsigned {
|
|
|
|
CreatePath = 0,
|
|
|
|
CreateFile = 1,
|
|
|
|
ModifyFile = 2,
|
|
|
|
MirrorFile = 3,
|
|
|
|
};
|
|
|
|
|
Update to v091r05 release.
[No prior releases were posted to the WIP thread. -Ed.]
byuu says:
Super Famicom mapping system has been reworked as discussed with the
mask= changes. offset becomes base, mode is gone. Also added support for
comma-separated fields in the address fields, to reduce the number of
map lines needed.
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">
<superfx revision="2">
<rom name="program.rom" size="0x200000"/>
<ram name="save.rwm" size="0x8000"/>
<map id="io" address="00-3f,80-bf:3000-32ff"/>
<map id="rom" address="00-3f:8000-ffff" mask="0x8000"/>
<map id="rom" address="40-5f:0000-ffff"/>
<map id="ram" address="00-3f,80-bf:6000-7fff" size="0x2000"/>
<map id="ram" address="70-71:0000-ffff"/>
</superfx>
</cartridge>
Or in BML:
cartridge region=NTSC
superfx revision=2
rom name=program.rom size=0x200000
ram name=save.rwm size=0x8000
map id=io address=00-3f,80-bf:3000-32ff
map id=rom address=00-3f:8000-ffff mask=0x8000
map id=rom address=40-5f:0000-ffff
map id=ram address=00-3f,80-bf:6000-7fff size=0x2000
map id=ram address=70-71:0000-ffff
As a result of the changes, old mappings will no longer work. The above
XML example will run Super Mario World 2: Yoshi's Island. Otherwise,
you'll have to write your own.
All that's left now is to work some sort of database mapping system in,
so I can start dumping carts en masse.
The NES changes that FitzRoy asked for are mostly in as well.
Also, part of the reason I haven't released a WIP ... but fuck it, I'm
not going to wait forever to post a new WIP.
I've added a skeleton driver to emulate Campus Challenge '92 and
Powerfest '94. There's no actual emulation, except for the stuff I can
glean from looking at the pictures of the board. It has a DSP-1 (so
SR/DR registers), four ROMs that map in and out, RAM, etc.
I've also added preliminary mapping to upload high scores to a website,
but obviously I need the ROMs first.
2012-10-09 08:25:32 +00:00
|
|
|
enum : unsigned {
|
|
|
|
OriginSource = 0,
|
|
|
|
OriginTarget = 1,
|
|
|
|
};
|
|
|
|
|
2012-08-16 10:30:47 +00:00
|
|
|
bool create(const string &patchName, const string &sourcePath, const string &targetPath, bool delta = false, const string &metadata = "") {
|
|
|
|
if(fp.open()) fp.close();
|
|
|
|
fp.open(patchName, file::mode::write);
|
|
|
|
checksum = ~0;
|
|
|
|
|
|
|
|
writeString("BPM1"); //signature
|
|
|
|
writeNumber(metadata.length());
|
|
|
|
writeString(metadata);
|
|
|
|
|
|
|
|
lstring sourceList, targetList;
|
|
|
|
ls(sourceList, sourcePath, sourcePath);
|
|
|
|
ls(targetList, targetPath, targetPath);
|
|
|
|
|
|
|
|
for(auto &targetName : targetList) {
|
|
|
|
if(targetName.endswith("/")) {
|
Update to v091r05 release.
[No prior releases were posted to the WIP thread. -Ed.]
byuu says:
Super Famicom mapping system has been reworked as discussed with the
mask= changes. offset becomes base, mode is gone. Also added support for
comma-separated fields in the address fields, to reduce the number of
map lines needed.
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">
<superfx revision="2">
<rom name="program.rom" size="0x200000"/>
<ram name="save.rwm" size="0x8000"/>
<map id="io" address="00-3f,80-bf:3000-32ff"/>
<map id="rom" address="00-3f:8000-ffff" mask="0x8000"/>
<map id="rom" address="40-5f:0000-ffff"/>
<map id="ram" address="00-3f,80-bf:6000-7fff" size="0x2000"/>
<map id="ram" address="70-71:0000-ffff"/>
</superfx>
</cartridge>
Or in BML:
cartridge region=NTSC
superfx revision=2
rom name=program.rom size=0x200000
ram name=save.rwm size=0x8000
map id=io address=00-3f,80-bf:3000-32ff
map id=rom address=00-3f:8000-ffff mask=0x8000
map id=rom address=40-5f:0000-ffff
map id=ram address=00-3f,80-bf:6000-7fff size=0x2000
map id=ram address=70-71:0000-ffff
As a result of the changes, old mappings will no longer work. The above
XML example will run Super Mario World 2: Yoshi's Island. Otherwise,
you'll have to write your own.
All that's left now is to work some sort of database mapping system in,
so I can start dumping carts en masse.
The NES changes that FitzRoy asked for are mostly in as well.
Also, part of the reason I haven't released a WIP ... but fuck it, I'm
not going to wait forever to post a new WIP.
I've added a skeleton driver to emulate Campus Challenge '92 and
Powerfest '94. There's no actual emulation, except for the stuff I can
glean from looking at the pictures of the board. It has a DSP-1 (so
SR/DR registers), four ROMs that map in and out, RAM, etc.
I've also added preliminary mapping to upload high scores to a website,
but obviously I need the ROMs first.
2012-10-09 08:25:32 +00:00
|
|
|
targetName.rtrim<1>("/");
|
2012-08-16 10:30:47 +00:00
|
|
|
writeNumber(CreatePath | ((targetName.length() - 1) << 2));
|
|
|
|
writeString(targetName);
|
Update to v091r05 release.
[No prior releases were posted to the WIP thread. -Ed.]
byuu says:
Super Famicom mapping system has been reworked as discussed with the
mask= changes. offset becomes base, mode is gone. Also added support for
comma-separated fields in the address fields, to reduce the number of
map lines needed.
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">
<superfx revision="2">
<rom name="program.rom" size="0x200000"/>
<ram name="save.rwm" size="0x8000"/>
<map id="io" address="00-3f,80-bf:3000-32ff"/>
<map id="rom" address="00-3f:8000-ffff" mask="0x8000"/>
<map id="rom" address="40-5f:0000-ffff"/>
<map id="ram" address="00-3f,80-bf:6000-7fff" size="0x2000"/>
<map id="ram" address="70-71:0000-ffff"/>
</superfx>
</cartridge>
Or in BML:
cartridge region=NTSC
superfx revision=2
rom name=program.rom size=0x200000
ram name=save.rwm size=0x8000
map id=io address=00-3f,80-bf:3000-32ff
map id=rom address=00-3f:8000-ffff mask=0x8000
map id=rom address=40-5f:0000-ffff
map id=ram address=00-3f,80-bf:6000-7fff size=0x2000
map id=ram address=70-71:0000-ffff
As a result of the changes, old mappings will no longer work. The above
XML example will run Super Mario World 2: Yoshi's Island. Otherwise,
you'll have to write your own.
All that's left now is to work some sort of database mapping system in,
so I can start dumping carts en masse.
The NES changes that FitzRoy asked for are mostly in as well.
Also, part of the reason I haven't released a WIP ... but fuck it, I'm
not going to wait forever to post a new WIP.
I've added a skeleton driver to emulate Campus Challenge '92 and
Powerfest '94. There's no actual emulation, except for the stuff I can
glean from looking at the pictures of the board. It has a DSP-1 (so
SR/DR registers), four ROMs that map in and out, RAM, etc.
I've also added preliminary mapping to upload high scores to a website,
but obviously I need the ROMs first.
2012-10-09 08:25:32 +00:00
|
|
|
} else if(auto position = sourceList.find(targetName)) { //if sourceName == targetName
|
2012-08-16 10:30:47 +00:00
|
|
|
file sp, dp;
|
|
|
|
sp.open({sourcePath, targetName}, file::mode::read);
|
|
|
|
dp.open({targetPath, targetName}, file::mode::read);
|
|
|
|
|
|
|
|
bool identical = sp.size() == dp.size();
|
|
|
|
uint32_t cksum = ~0;
|
|
|
|
|
|
|
|
for(unsigned n = 0; n < sp.size(); n++) {
|
|
|
|
uint8_t byte = sp.read();
|
|
|
|
if(identical && byte != dp.read()) identical = false;
|
|
|
|
cksum = crc32_adjust(cksum, byte);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(identical) {
|
Update to v091r05 release.
[No prior releases were posted to the WIP thread. -Ed.]
byuu says:
Super Famicom mapping system has been reworked as discussed with the
mask= changes. offset becomes base, mode is gone. Also added support for
comma-separated fields in the address fields, to reduce the number of
map lines needed.
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">
<superfx revision="2">
<rom name="program.rom" size="0x200000"/>
<ram name="save.rwm" size="0x8000"/>
<map id="io" address="00-3f,80-bf:3000-32ff"/>
<map id="rom" address="00-3f:8000-ffff" mask="0x8000"/>
<map id="rom" address="40-5f:0000-ffff"/>
<map id="ram" address="00-3f,80-bf:6000-7fff" size="0x2000"/>
<map id="ram" address="70-71:0000-ffff"/>
</superfx>
</cartridge>
Or in BML:
cartridge region=NTSC
superfx revision=2
rom name=program.rom size=0x200000
ram name=save.rwm size=0x8000
map id=io address=00-3f,80-bf:3000-32ff
map id=rom address=00-3f:8000-ffff mask=0x8000
map id=rom address=40-5f:0000-ffff
map id=ram address=00-3f,80-bf:6000-7fff size=0x2000
map id=ram address=70-71:0000-ffff
As a result of the changes, old mappings will no longer work. The above
XML example will run Super Mario World 2: Yoshi's Island. Otherwise,
you'll have to write your own.
All that's left now is to work some sort of database mapping system in,
so I can start dumping carts en masse.
The NES changes that FitzRoy asked for are mostly in as well.
Also, part of the reason I haven't released a WIP ... but fuck it, I'm
not going to wait forever to post a new WIP.
I've added a skeleton driver to emulate Campus Challenge '92 and
Powerfest '94. There's no actual emulation, except for the stuff I can
glean from looking at the pictures of the board. It has a DSP-1 (so
SR/DR registers), four ROMs that map in and out, RAM, etc.
I've also added preliminary mapping to upload high scores to a website,
but obviously I need the ROMs first.
2012-10-09 08:25:32 +00:00
|
|
|
writeNumber(MirrorFile | ((targetName.length() - 1) << 2));
|
|
|
|
writeString(targetName);
|
|
|
|
writeNumber(OriginSource);
|
2012-08-16 10:30:47 +00:00
|
|
|
writeChecksum(~cksum);
|
|
|
|
} else {
|
Update to v091r05 release.
[No prior releases were posted to the WIP thread. -Ed.]
byuu says:
Super Famicom mapping system has been reworked as discussed with the
mask= changes. offset becomes base, mode is gone. Also added support for
comma-separated fields in the address fields, to reduce the number of
map lines needed.
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">
<superfx revision="2">
<rom name="program.rom" size="0x200000"/>
<ram name="save.rwm" size="0x8000"/>
<map id="io" address="00-3f,80-bf:3000-32ff"/>
<map id="rom" address="00-3f:8000-ffff" mask="0x8000"/>
<map id="rom" address="40-5f:0000-ffff"/>
<map id="ram" address="00-3f,80-bf:6000-7fff" size="0x2000"/>
<map id="ram" address="70-71:0000-ffff"/>
</superfx>
</cartridge>
Or in BML:
cartridge region=NTSC
superfx revision=2
rom name=program.rom size=0x200000
ram name=save.rwm size=0x8000
map id=io address=00-3f,80-bf:3000-32ff
map id=rom address=00-3f:8000-ffff mask=0x8000
map id=rom address=40-5f:0000-ffff
map id=ram address=00-3f,80-bf:6000-7fff size=0x2000
map id=ram address=70-71:0000-ffff
As a result of the changes, old mappings will no longer work. The above
XML example will run Super Mario World 2: Yoshi's Island. Otherwise,
you'll have to write your own.
All that's left now is to work some sort of database mapping system in,
so I can start dumping carts en masse.
The NES changes that FitzRoy asked for are mostly in as well.
Also, part of the reason I haven't released a WIP ... but fuck it, I'm
not going to wait forever to post a new WIP.
I've added a skeleton driver to emulate Campus Challenge '92 and
Powerfest '94. There's no actual emulation, except for the stuff I can
glean from looking at the pictures of the board. It has a DSP-1 (so
SR/DR registers), four ROMs that map in and out, RAM, etc.
I've also added preliminary mapping to upload high scores to a website,
but obviously I need the ROMs first.
2012-10-09 08:25:32 +00:00
|
|
|
writeNumber(ModifyFile | ((targetName.length() - 1) << 2));
|
|
|
|
writeString(targetName);
|
|
|
|
writeNumber(OriginSource);
|
|
|
|
|
|
|
|
if(delta == false) {
|
|
|
|
bpslinear patch;
|
|
|
|
patch.source({sourcePath, targetName});
|
|
|
|
patch.target({targetPath, targetName});
|
|
|
|
patch.create({temppath(), "temp.bps"});
|
|
|
|
} else {
|
|
|
|
bpsdelta patch;
|
|
|
|
patch.source({sourcePath, targetName});
|
|
|
|
patch.target({targetPath, targetName});
|
|
|
|
patch.create({temppath(), "temp.bps"});
|
|
|
|
}
|
|
|
|
|
|
|
|
auto buffer = file::read({temppath(), "temp.bps"});
|
|
|
|
writeNumber(buffer.size());
|
|
|
|
for(auto &byte : buffer) write(byte);
|
2012-08-16 10:30:47 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
writeNumber(CreateFile | ((targetName.length() - 1) << 2));
|
|
|
|
writeString(targetName);
|
|
|
|
auto buffer = file::read({targetPath, targetName});
|
|
|
|
writeNumber(buffer.size());
|
|
|
|
for(auto &byte : buffer) write(byte);
|
|
|
|
writeChecksum(crc32_calculate(buffer.data(), buffer.size()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//checksum
|
|
|
|
writeChecksum(~checksum);
|
|
|
|
fp.close();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool apply(const string &patchName, const string &sourcePath, const string &targetPath) {
|
|
|
|
directory::remove(targetPath); //start with a clean directory
|
|
|
|
directory::create(targetPath);
|
|
|
|
|
|
|
|
if(fp.open()) fp.close();
|
|
|
|
fp.open(patchName, file::mode::read);
|
|
|
|
checksum = ~0;
|
|
|
|
|
|
|
|
if(readString(4) != "BPM1") return false;
|
|
|
|
auto metadataLength = readNumber();
|
|
|
|
while(metadataLength--) read();
|
|
|
|
|
|
|
|
while(fp.offset() < fp.size() - 4) {
|
|
|
|
auto encoding = readNumber();
|
|
|
|
unsigned action = encoding & 3;
|
|
|
|
unsigned targetLength = (encoding >> 2) + 1;
|
|
|
|
string targetName = readString(targetLength);
|
|
|
|
|
|
|
|
if(action == CreatePath) {
|
Update to v091r05 release.
[No prior releases were posted to the WIP thread. -Ed.]
byuu says:
Super Famicom mapping system has been reworked as discussed with the
mask= changes. offset becomes base, mode is gone. Also added support for
comma-separated fields in the address fields, to reduce the number of
map lines needed.
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">
<superfx revision="2">
<rom name="program.rom" size="0x200000"/>
<ram name="save.rwm" size="0x8000"/>
<map id="io" address="00-3f,80-bf:3000-32ff"/>
<map id="rom" address="00-3f:8000-ffff" mask="0x8000"/>
<map id="rom" address="40-5f:0000-ffff"/>
<map id="ram" address="00-3f,80-bf:6000-7fff" size="0x2000"/>
<map id="ram" address="70-71:0000-ffff"/>
</superfx>
</cartridge>
Or in BML:
cartridge region=NTSC
superfx revision=2
rom name=program.rom size=0x200000
ram name=save.rwm size=0x8000
map id=io address=00-3f,80-bf:3000-32ff
map id=rom address=00-3f:8000-ffff mask=0x8000
map id=rom address=40-5f:0000-ffff
map id=ram address=00-3f,80-bf:6000-7fff size=0x2000
map id=ram address=70-71:0000-ffff
As a result of the changes, old mappings will no longer work. The above
XML example will run Super Mario World 2: Yoshi's Island. Otherwise,
you'll have to write your own.
All that's left now is to work some sort of database mapping system in,
so I can start dumping carts en masse.
The NES changes that FitzRoy asked for are mostly in as well.
Also, part of the reason I haven't released a WIP ... but fuck it, I'm
not going to wait forever to post a new WIP.
I've added a skeleton driver to emulate Campus Challenge '92 and
Powerfest '94. There's no actual emulation, except for the stuff I can
glean from looking at the pictures of the board. It has a DSP-1 (so
SR/DR registers), four ROMs that map in and out, RAM, etc.
I've also added preliminary mapping to upload high scores to a website,
but obviously I need the ROMs first.
2012-10-09 08:25:32 +00:00
|
|
|
directory::create({targetPath, targetName, "/"});
|
2012-08-16 10:30:47 +00:00
|
|
|
} else if(action == CreateFile) {
|
|
|
|
file fp;
|
|
|
|
fp.open({targetPath, targetName}, file::mode::write);
|
|
|
|
auto fileSize = readNumber();
|
|
|
|
while(fileSize--) fp.write(read());
|
|
|
|
uint32_t cksum = readChecksum();
|
|
|
|
} else if(action == ModifyFile) {
|
Update to v091r05 release.
[No prior releases were posted to the WIP thread. -Ed.]
byuu says:
Super Famicom mapping system has been reworked as discussed with the
mask= changes. offset becomes base, mode is gone. Also added support for
comma-separated fields in the address fields, to reduce the number of
map lines needed.
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">
<superfx revision="2">
<rom name="program.rom" size="0x200000"/>
<ram name="save.rwm" size="0x8000"/>
<map id="io" address="00-3f,80-bf:3000-32ff"/>
<map id="rom" address="00-3f:8000-ffff" mask="0x8000"/>
<map id="rom" address="40-5f:0000-ffff"/>
<map id="ram" address="00-3f,80-bf:6000-7fff" size="0x2000"/>
<map id="ram" address="70-71:0000-ffff"/>
</superfx>
</cartridge>
Or in BML:
cartridge region=NTSC
superfx revision=2
rom name=program.rom size=0x200000
ram name=save.rwm size=0x8000
map id=io address=00-3f,80-bf:3000-32ff
map id=rom address=00-3f:8000-ffff mask=0x8000
map id=rom address=40-5f:0000-ffff
map id=ram address=00-3f,80-bf:6000-7fff size=0x2000
map id=ram address=70-71:0000-ffff
As a result of the changes, old mappings will no longer work. The above
XML example will run Super Mario World 2: Yoshi's Island. Otherwise,
you'll have to write your own.
All that's left now is to work some sort of database mapping system in,
so I can start dumping carts en masse.
The NES changes that FitzRoy asked for are mostly in as well.
Also, part of the reason I haven't released a WIP ... but fuck it, I'm
not going to wait forever to post a new WIP.
I've added a skeleton driver to emulate Campus Challenge '92 and
Powerfest '94. There's no actual emulation, except for the stuff I can
glean from looking at the pictures of the board. It has a DSP-1 (so
SR/DR registers), four ROMs that map in and out, RAM, etc.
I've also added preliminary mapping to upload high scores to a website,
but obviously I need the ROMs first.
2012-10-09 08:25:32 +00:00
|
|
|
auto encoding = readNumber();
|
|
|
|
string originPath = encoding & 1 ? targetPath : sourcePath;
|
|
|
|
string sourceName = (encoding >> 1) == 0 ? targetName : readString(encoding >> 1);
|
2012-08-16 10:30:47 +00:00
|
|
|
auto patchSize = readNumber();
|
|
|
|
vector<uint8_t> buffer;
|
|
|
|
buffer.resize(patchSize);
|
|
|
|
for(unsigned n = 0; n < patchSize; n++) buffer[n] = read();
|
|
|
|
bpspatch patch;
|
|
|
|
patch.modify(buffer.data(), buffer.size());
|
Update to v091r05 release.
[No prior releases were posted to the WIP thread. -Ed.]
byuu says:
Super Famicom mapping system has been reworked as discussed with the
mask= changes. offset becomes base, mode is gone. Also added support for
comma-separated fields in the address fields, to reduce the number of
map lines needed.
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">
<superfx revision="2">
<rom name="program.rom" size="0x200000"/>
<ram name="save.rwm" size="0x8000"/>
<map id="io" address="00-3f,80-bf:3000-32ff"/>
<map id="rom" address="00-3f:8000-ffff" mask="0x8000"/>
<map id="rom" address="40-5f:0000-ffff"/>
<map id="ram" address="00-3f,80-bf:6000-7fff" size="0x2000"/>
<map id="ram" address="70-71:0000-ffff"/>
</superfx>
</cartridge>
Or in BML:
cartridge region=NTSC
superfx revision=2
rom name=program.rom size=0x200000
ram name=save.rwm size=0x8000
map id=io address=00-3f,80-bf:3000-32ff
map id=rom address=00-3f:8000-ffff mask=0x8000
map id=rom address=40-5f:0000-ffff
map id=ram address=00-3f,80-bf:6000-7fff size=0x2000
map id=ram address=70-71:0000-ffff
As a result of the changes, old mappings will no longer work. The above
XML example will run Super Mario World 2: Yoshi's Island. Otherwise,
you'll have to write your own.
All that's left now is to work some sort of database mapping system in,
so I can start dumping carts en masse.
The NES changes that FitzRoy asked for are mostly in as well.
Also, part of the reason I haven't released a WIP ... but fuck it, I'm
not going to wait forever to post a new WIP.
I've added a skeleton driver to emulate Campus Challenge '92 and
Powerfest '94. There's no actual emulation, except for the stuff I can
glean from looking at the pictures of the board. It has a DSP-1 (so
SR/DR registers), four ROMs that map in and out, RAM, etc.
I've also added preliminary mapping to upload high scores to a website,
but obviously I need the ROMs first.
2012-10-09 08:25:32 +00:00
|
|
|
patch.source({originPath, sourceName});
|
2012-08-16 10:30:47 +00:00
|
|
|
patch.target({targetPath, targetName});
|
|
|
|
if(patch.apply() != bpspatch::result::success) return false;
|
|
|
|
} else if(action == MirrorFile) {
|
Update to v091r05 release.
[No prior releases were posted to the WIP thread. -Ed.]
byuu says:
Super Famicom mapping system has been reworked as discussed with the
mask= changes. offset becomes base, mode is gone. Also added support for
comma-separated fields in the address fields, to reduce the number of
map lines needed.
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">
<superfx revision="2">
<rom name="program.rom" size="0x200000"/>
<ram name="save.rwm" size="0x8000"/>
<map id="io" address="00-3f,80-bf:3000-32ff"/>
<map id="rom" address="00-3f:8000-ffff" mask="0x8000"/>
<map id="rom" address="40-5f:0000-ffff"/>
<map id="ram" address="00-3f,80-bf:6000-7fff" size="0x2000"/>
<map id="ram" address="70-71:0000-ffff"/>
</superfx>
</cartridge>
Or in BML:
cartridge region=NTSC
superfx revision=2
rom name=program.rom size=0x200000
ram name=save.rwm size=0x8000
map id=io address=00-3f,80-bf:3000-32ff
map id=rom address=00-3f:8000-ffff mask=0x8000
map id=rom address=40-5f:0000-ffff
map id=ram address=00-3f,80-bf:6000-7fff size=0x2000
map id=ram address=70-71:0000-ffff
As a result of the changes, old mappings will no longer work. The above
XML example will run Super Mario World 2: Yoshi's Island. Otherwise,
you'll have to write your own.
All that's left now is to work some sort of database mapping system in,
so I can start dumping carts en masse.
The NES changes that FitzRoy asked for are mostly in as well.
Also, part of the reason I haven't released a WIP ... but fuck it, I'm
not going to wait forever to post a new WIP.
I've added a skeleton driver to emulate Campus Challenge '92 and
Powerfest '94. There's no actual emulation, except for the stuff I can
glean from looking at the pictures of the board. It has a DSP-1 (so
SR/DR registers), four ROMs that map in and out, RAM, etc.
I've also added preliminary mapping to upload high scores to a website,
but obviously I need the ROMs first.
2012-10-09 08:25:32 +00:00
|
|
|
auto encoding = readNumber();
|
|
|
|
string originPath = encoding & 1 ? targetPath : sourcePath;
|
|
|
|
string sourceName = (encoding >> 1) == 0 ? targetName : readString(encoding >> 1);
|
|
|
|
file::copy({originPath, sourceName}, {targetPath, targetName});
|
2012-08-16 10:30:47 +00:00
|
|
|
uint32_t cksum = readChecksum();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t cksum = ~checksum;
|
|
|
|
if(read() != (uint8_t)(cksum >> 0)) return false;
|
|
|
|
if(read() != (uint8_t)(cksum >> 8)) return false;
|
|
|
|
if(read() != (uint8_t)(cksum >> 16)) return false;
|
|
|
|
if(read() != (uint8_t)(cksum >> 24)) return false;
|
|
|
|
|
|
|
|
fp.close();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
file fp;
|
|
|
|
uint32_t checksum;
|
|
|
|
|
|
|
|
//create() functions
|
|
|
|
void ls(lstring &list, const string &path, const string &basepath) {
|
|
|
|
lstring paths = directory::folders(path);
|
|
|
|
for(auto &pathname : paths) {
|
|
|
|
list.append(string{path, pathname}.ltrim<1>(basepath));
|
|
|
|
ls(list, {path, pathname}, basepath);
|
|
|
|
}
|
|
|
|
|
|
|
|
lstring files = directory::files(path);
|
|
|
|
for(auto &filename : files) {
|
|
|
|
list.append(string{path, filename}.ltrim<1>(basepath));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void write(uint8_t data) {
|
|
|
|
fp.write(data);
|
|
|
|
checksum = crc32_adjust(checksum, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void writeNumber(uint64_t data) {
|
|
|
|
while(true) {
|
|
|
|
uint64_t x = data & 0x7f;
|
|
|
|
data >>= 7;
|
|
|
|
if(data == 0) {
|
|
|
|
write(0x80 | x);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
write(x);
|
|
|
|
data--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void writeString(const string &text) {
|
|
|
|
unsigned length = text.length();
|
|
|
|
for(unsigned n = 0; n < length; n++) write(text[n]);
|
|
|
|
}
|
|
|
|
|
|
|
|
void writeChecksum(uint32_t cksum) {
|
|
|
|
write(cksum >> 0);
|
|
|
|
write(cksum >> 8);
|
|
|
|
write(cksum >> 16);
|
|
|
|
write(cksum >> 24);
|
|
|
|
}
|
|
|
|
|
|
|
|
//apply() functions
|
|
|
|
uint8_t read() {
|
|
|
|
uint8_t data = fp.read();
|
|
|
|
checksum = crc32_adjust(checksum, data);
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t readNumber() {
|
|
|
|
uint64_t data = 0, shift = 1;
|
|
|
|
while(true) {
|
|
|
|
uint8_t x = read();
|
|
|
|
data += (x & 0x7f) * shift;
|
|
|
|
if(x & 0x80) break;
|
|
|
|
shift <<= 7;
|
|
|
|
data += shift;
|
|
|
|
}
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
string readString(unsigned length) {
|
|
|
|
string text;
|
|
|
|
text.reserve(length + 1);
|
|
|
|
for(unsigned n = 0; n < length; n++) text[n] = read();
|
|
|
|
text[length] = 0;
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t readChecksum() {
|
|
|
|
uint32_t checksum = 0;
|
|
|
|
checksum |= read() << 0;
|
|
|
|
checksum |= read() << 8;
|
|
|
|
checksum |= read() << 16;
|
|
|
|
checksum |= read() << 24;
|
|
|
|
return checksum;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|