本文整理汇总了C++中WritableROM类的典型用法代码示例。如果您正苦于以下问题:C++ WritableROM类的具体用法?C++ WritableROM怎么用?C++ WritableROM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WritableROM类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
void TailsAdvBank0Hacks::addRegularInventoryHotswapHack(
WritableROM& rom) {
// Write hotswap hack
rom.directWrite(regularInventoryHotswapHackMainAddress,
regularInventoryHotswapHackMainData,
regularInventoryHotswapHackMainLength);
// Write hotswap trigger
rom.directWrite(regularInventoryHotswapHackTriggerAddress,
regularInventoryHotswapHackTriggerData,
regularInventoryHotswapHackTriggerLength);
}
开发者ID:suppertails66,项目名称:tales,代码行数:12,代码来源:TailsAdvBank0Hacks.cpp
示例2: addUseAllInventoryHack
void TailsAdvBank0Hacks::addFullInventoryHotswapHack(
WritableROM& rom) {
// Use full inventory
addUseAllInventoryHack(rom);
// Write hotswap hack
rom.directWrite(fullInventoryHotswapHackMainAddress,
fullInventoryHotswapHackMainData,
fullInventoryHotswapHackMainLength);
// Write hotswap trigger
rom.directWrite(fullInventoryHotswapHackTriggerAddress,
fullInventoryHotswapHackTriggerData,
fullInventoryHotswapHackTriggerLength);
}
开发者ID:suppertails66,项目名称:tales,代码行数:15,代码来源:TailsAdvBank0Hacks.cpp
示例3: addSaveHackBase
void TailsAdvBank0Hacks::addAutoSaveHack(
WritableROM& rom) {
addSaveHackBase(rom);
rom.directWrite(autoSaveHackAddress,
autoSaveHackData,
autoSaveHackLength);
}
开发者ID:suppertails66,项目名称:tales,代码行数:7,代码来源:TailsAdvBank0Hacks.cpp
示例4: exportElementToROM
void EditableSpawnPoints::exportElementToROM(WritableROM& rom,
Taddress address,
SpawnPointCollection& src) {
Taddress writeAddress = address;
for (SpawnPointCollection::iterator it = src.begin();
it != src.end();
++it) {
// std::cout << writeAddress << std::endl;
// std::cout << '\t' << it->camX() << std::endl;
// Buffer for data
Tbyte dataBuffer[SpawnPoint::dataSize];
// Write spawn to data
it->writeToData(dataBuffer);
// for (int i = 0; i < SpawnPoint::dataSize; i++) {
// std::cout << (int)(dataBuffer[i]) << " ";
// }
// std::cout << std::endl;
// Copy raw spawn data to ROM
rom.directWrite(writeAddress,
dataBuffer,
SpawnPoint::dataSize);
// Advance to next address
writeAddress += SpawnPoint::dataSize;
}
}
开发者ID:suppertails66,项目名称:tales,代码行数:30,代码来源:EditableSpawnPoints.cpp
示例5: exportToROM
void EditablePowerUpData::exportToROM(WritableROM& rom) {
int byteCount = 0;
for (int i = 0; i < numPowerUps_; i++) {
ByteConversion::toBytes(MiscMath::toBCD(maxHealthPerPowerup_[i]),
rom.directWrite(powerUpTableAddress_
+ byteCount),
ByteSizes::uint8Size,
EndiannessTypes::little,
SignednessTypes::nosign);
byteCount += ByteSizes::uint8Size;
ByteConversion::toBytes(flightTimePerPowerup_[i],
rom.directWrite(powerUpTableAddress_
+ byteCount),
ByteSizes::uint16Size,
EndiannessTypes::little,
SignednessTypes::nosign);
byteCount += ByteSizes::uint16Size;
}
}
开发者ID:suppertails66,项目名称:tales,代码行数:21,代码来源:EditablePowerUpData.cpp
示例6: exportToROM
void TailsAdvData::exportToROM(WritableROM& rom) {
/* A VERY LONG SEQUENCE OF EXPORTS GOES HERE */
if (romExpanded_) {
// If the ROM has been expanded, there are now 0x40 rather than 0x20
// valid banks. However, there are a handful of pieces of code that
// mask a value by 0x1F to obtain a bank number. We need to adjust these
// to 0x3F or the program will be unable to access the new banks.
rom.directWrite(andMaskExpandAdjustAddress1,
andMaskExpandAdjustValue,
ByteSizes::uint8Size);
rom.directWrite(andMaskExpandAdjustAddress2,
andMaskExpandAdjustValue,
ByteSizes::uint8Size);
}
standardPalettes_.exportToROM(rom);
paletteCycles_.exportToROM(rom);
levelEffectsHeaders_.exportToROM(rom);
levelPaletteHeaders_.exportToROM(rom);
levelGraphicsData_.exportToROM(rom);
tileMaps_.exportToROM(rom);
leafGraphicsTable_.exportToROM(rom);
waterSplashGraphicTable_.exportToROM(rom);
smokePuffGraphicTable_.exportToROM(rom);
spriteMappings_.exportToROM(rom);
musicAssignments_.exportToROM(rom);
radioMusic_.exportToROM(rom);
powerUpData_.exportToROM(rom);
emeraldHealthRefills_.exportToROM(rom);
metatileWidthMaps_.exportToROM(rom);
metatileHeightMaps_.exportToROM(rom);
slopeSpeedValues_.exportToROM(rom);
metatileBehaviors_.exportToROM(rom);
spawnPoints_.exportToROM(rom);
warpDestinations_.exportToROM(rom);
levelObjectEntryGroups_.exportToROM(rom);
mapData_.exportToROM(rom);
}
开发者ID:suppertails66,项目名称:tales,代码行数:40,代码来源:TailsAdvData.cpp
示例7: exportToROM
void EditableLevelPaletteHeaders::exportToROM(WritableROM& rom) {
// Write palette headers
int contentWriteAddress = tableContentAddress_;
for (LevelPaletteHeaderCollection::iterator it = primaryStorage_.begin();
it != primaryStorage_.end();
it++) {
it->exportToROM(rom,
contentWriteAddress);
contentWriteAddress += LevelPaletteHeader::dataSize;
}
// Write table header
int headerWriteAddress = tableHeaderAddress_;
// std::cout << "start: " << std::hex << headerWriteAddress << std::endl;
for (int i = 0; i < mapnumToIndex_.numPrimaryKeys(); i++) {
// std::cout << "at: " << std::hex << headerWriteAddress << std::endl;
// Only write used keys
if (mapnumToIndex_.subKeyTable()[i] > 0) {
// std::cout << '\t' << "writing " << std::hex << i << std::endl;
int index = mapnumToIndex_.refDataByKeys(
i,
TwoKeyedAddress::subKeyBase);
// std::cout << '\t' << "index: " << index << std::endl;
// Get banked address of content
Taddress address
= LoadedROM::indexToBankedAddr(tableContentAddress_,
index,
LevelPaletteHeader::dataSize);
Tbyte buffer[ByteSizes::uint16Size];
ByteConversion::toBytes(address,
buffer,
ByteSizes::uint16Size,
EndiannessTypes::little,
SignednessTypes::nosign);
// std::cout << "number: " << std::hex << i << std::endl;
// std::cout << "write address: " << std::hex << headerWriteAddress << std::endl;
// Write address to ROM
rom.directWrite(headerWriteAddress,
buffer,
ByteSizes::uint16Size);
}
// Go to next address
headerWriteAddress += ByteSizes::uint16Size;
}
}
开发者ID:GerbilSoft,项目名称:tales,代码行数:50,代码来源:EditableLevelPaletteHeaders.cpp
示例8: exportToROM
void EditableSlopeSpeedValues::exportToROM(WritableROM& rom) {
// Write each value to ROM
int writeAddress = baseAddress_;
for (SlopeSpeedValueCollection::iterator it = speedValues_.begin();
it != speedValues_.end();
++it) {
Tbyte buffer[ByteSizes::int16Size];
ByteConversion::toBytes(*it,
buffer,
ByteSizes::int16Size,
EndiannessTypes::little,
SignednessTypes::sign);
rom.directWrite(writeAddress,
buffer,
ByteSizes::int16Size);
writeAddress += ByteSizes::int16Size;
}
}
开发者ID:suppertails66,项目名称:tales,代码行数:18,代码来源:EditableSlopeSpeedValues.cpp
示例9: exportSize
void MetatileStructureSet::exportToROM(WritableROM& rom) {
// TODO: support for adding metatile definitions
// search freespace &c
FreeSpaceList::iterator spaceIt = rom.freeSpace().getFreeSpace(
exportSize());
if (spaceIt == rom.freeSpace().freeSpaceList().end()) {
throw NotEnoughSpaceException(TALES_SRCANDLINE,
"MetatileStructureSet::exportToROM("
"WritableROM&)",
exportSize());
}
int writeAddress = spaceIt->address();
address_ = spaceIt->address();
rom.freeSpace().claimSpace(spaceIt, exportSize());
// std::cout << "addr: " << writeAddress << std::endl;
// Starting address of structure definitions
int contentStartAddress = writeAddress
+ (index_.size() * ByteSizes::uint16Size);
// Write the index
for (MetatileIndexToStructureMap::iterator it = index_.begin();
it != index_.end();
it++) {
int contentIndex = it->second;
// Compute the address of the content
Taddress contentAddress = (contentStartAddress
+ (contentIndex * MetatileStructure::dataSize));
// Convert to banked address
Taddress contentBankedAddress = LoadedROM
::directToBankedAddress(contentAddress);
// Write to index
Tbyte buffer[ByteSizes::uint16Size];
ByteConversion::toBytes(contentBankedAddress,
buffer,
ByteSizes::uint16Size,
EndiannessTypes::little,
SignednessTypes::nosign);
rom.directWrite(writeAddress + (it->first * ByteSizes::uint16Size),
buffer,
ByteSizes::uint16Size);
}
// Write content
int metatileNum = 0;
for (MetatileStructureCollection::iterator it = primaryStorage_.begin();
it != primaryStorage_.end();
it++) {
// Write metatile to buffer
Tbyte buffer[MetatileStructure::dataSize];
it->writeToData(buffer);
// Write buffer to table
rom.directWrite(contentStartAddress
+ (metatileNum * MetatileStructure::dataSize),
buffer,
MetatileStructure::dataSize);
++metatileNum;
}
// std::cout << "metatiles: " << metatileNum << std::endl;
// std::cout << std::endl;
}
开发者ID:GerbilSoft,项目名称:tales,代码行数:70,代码来源:MetatileStructureSet.cpp
示例10: exportTable
void EditableLevelObjectEntryGroups::exportTable(
Taddress exportAddress,
WritableROM& rom) {
// std::cout << "Exporting to: " << exportAddress << std::endl;
// Subkey address write location
Taddress subkeyWriteAddress = exportAddress
+ (primaryMapLimit
* ByteSizes::uint16Size);
// std::cout << std::hex << subkeyWriteAddress << std::endl;
// Determine total number of maps to output
int numSubkeyEntries = 0;
for (int i = 0; i < mapnumToAddress_.numPrimaryKeys(); i++) {
// If at least one entry for this primary key, use first entry
if (mapnumToAddress_.subKeyTable()[i] > 0) {
numSubkeyEntries += mapnumToAddress_.subKeyTable()[i];
}
}
// Compute base address for entries
Taddress entryWriteAddress = subkeyWriteAddress
+ (numSubkeyEntries
* ByteSizes::uint16Size);
// Temporarily convert address table to index table
for (int i = 0; i < mapnumToAddress_.numPrimaryKeys(); i++) {
for (int j = 0; j < mapnumToAddress_.subKeyTable()[i]; j++) {
Taddress& addr = mapnumToAddress_.refDataByKeys(
i + TwoKeyedAddress::primaryKeyBase,
j + TwoKeyedAddress::subKeyBase);
int ind = addressToIndex_.findValueOrThrow(addr);
addr = ind;
}
}
// Clear address to index map
addressToIndex_.clear();
// Create temporary mapping of indices to address
Tmap<int, Taddress> indToAddr;
for (int i = 0; i < primaryStorage_.size(); i++) {
// Add new (temporary) index->address mapping
indToAddr.insert(Tmap<int, Taddress>::PairType(
i, entryWriteAddress));
// Write entry to ROM
int writeLength = primaryStorage_[i].writeToData(
rom.directWrite(entryWriteAddress));
// Add new address->index mapping
addressToIndex_.insert(
BaseEditableMappedData<LevelObjectEntryGroup>
::AddressIndexPair(
entryWriteAddress,
i));
// Write subkey address
/* Taddress bankedAddress = LoadedROM::directToBankedAddress(
entryWriteAddress);
ByteConversion::toBytes(bankedAddress,
rom.directWrite(subkeyWriteAddress),
ByteSizes::uint16Size,
EndiannessTypes::little,
SignednessTypes::nosign);
// std::cout << std::hex << "value: " << bankedAddress << std::endl;
// std::cout << std::hex << "addr: " << subkeyWriteAddress << std::endl;
// Move to next address
subkeyWriteAddress += ByteSizes::uint16Size; */
entryWriteAddress += writeLength;
}
// Write the address table to the export location
Taddress primaryWriteAddress = exportAddress;
int totalMaps = 0;
for (int i = 0; i < mapnumToAddress_.numPrimaryKeys(); i++) {
Taddress bankedAddress = exportAddress
+ (primaryMapLimit
* ByteSizes::uint16Size);
// If at least one entry for this primary key, use first entry
if (mapnumToAddress_.subKeyTable()[i] > 0) {
bankedAddress += (totalMaps * ByteSizes::uint16Size);
totalMaps += mapnumToAddress_.subKeyTable()[i];
/* bankedAddress
= indToAddr.findValueOrThrow(
mapnumToAddress_.refDataByKeys(
i + TwoKeyedAddress::primaryKeyBase,
TwoKeyedAddress::subKeyBase)); */
}
//.........这里部分代码省略.........
开发者ID:suppertails66,项目名称:tales,代码行数:101,代码来源:EditableLevelObjectEntryGroups.cpp
示例11: exportElementToROM
void EditableLevelObjectEntryGroups::exportElementToROM(WritableROM& rom,
Taddress address,
LevelObjectEntryGroup& src) {
src.writeToData(rom.directWrite(address));
}
开发者ID:suppertails66,项目名称:tales,代码行数:5,代码来源:EditableLevelObjectEntryGroups.cpp
示例12: NotEnoughSpaceException
Taddress EditableLevelObjectEntryGroups::moveToNewBank(WritableROM& rom) {
// std::cout << "Preparing to move to new bank" << std::endl;
// More for convenience than anything else, we grab a whole bank of data
// for use by this table (and a few bits of associated code).
// Note that this basically requires expanding the ROM to 1 MB
FreeSpaceList::iterator spaceIt
= rom.freeSpace().getFreeSpace(LoadedROM::bankSize);
// Throw if a full bank isn't available
if (spaceIt == rom.freeSpace().freeSpaceList().end()) {
throw NotEnoughSpaceException(TALES_SRCANDLINE,
"EditableLevelObjectEntryGroups::"
"exportToROM(WritableROM&)",
LoadedROM::bankSize);
}
// std::cout << spaceIt->address() << " " << spaceIt->length() << std::endl;
Taddress newBaseAddress = spaceIt->address();
// Claim the bank
rom.freeSpace().claimSpace(spaceIt,
LoadedROM::bankSize);
// std::cout << "New base address: " << newBaseAddress << std::endl;
// Copy code segments C1 and C3 to new bank.
// C1 and C3 both contain code that references the object table,
// so they must (to avoid more complicated hacking) be in the same bank.
// After rearranging the code, the new bank will contain C1, C3, and
// the object table, in that order, starting from the beginning of the
// bank
// Copy C1 to start of bank
Taddress newC1Address = newBaseAddress;
std::memcpy(rom.directWrite(newC1Address),
codeSegmentC1,
lengthOfC1Segment);
// Copy C3 to directly after C1
Taddress newC3Address = newC1Address
+ lengthOfC1Segment;
std::memcpy(rom.directWrite(newC3Address),
codeSegmentC3,
lengthOfC3Segment);
// Set new export address for table (directly after C3)
int exportAddress = newBaseAddress
+ lengthOfC1Segment
+ lengthOfC3Segment;
// std::cout << "New C1 address: " << newC1Address << std::endl;
// std::cout << "New C3 address: " << newC3Address << std::endl;
// std::cout << "Export address: " << exportAddress << std::endl;
// Update all the code that references the old locations of C1 and C3
// Get the banked address for the new direct address of C1
int newC1BankNum = LoadedROM::directToBankNum(newC1Address);
int newC1BankedAddress = LoadedROM::directToBankedAddress(newC1Address);
// Get the banked address for the new direct address of C3
int newC3BankNum = LoadedROM::directToBankNum(newC3Address);
int newC3BankedAddress = LoadedROM::directToBankedAddress(newC3Address);
// Update bank number in code that calls C1
ByteConversion::toBytes(newC1BankNum,
rom.directWrite(callReferenceToC1Bank),
ByteSizes::uint8Size,
EndiannessTypes::little,
SignednessTypes::nosign);
// C1's banked address is the same (0000), so we don't need to update it
// ... but do anyway for consistency
ByteConversion::toBytes(newC1BankedAddress,
rom.directWrite(callReferenceToC1Address),
ByteSizes::uint16Size,
EndiannessTypes::little,
SignednessTypes::nosign);
// Update banked address in code that calls C3
ByteConversion::toBytes(newC3BankNum,
rom.directWrite(callReferenceToC3Bank),
ByteSizes::uint8Size,
EndiannessTypes::little,
SignednessTypes::nosign);
// Update bank number in code that calls C3.
ByteConversion::toBytes(newC3BankedAddress,
rom.directWrite(callReferenceToC3Address),
ByteSizes::uint16Size,
EndiannessTypes::little,
SignednessTypes::nosign);
// C3 contains a hardcoded JP instruction into itself. Since we moved
// C3, we have to update the JP to correspond to the new location.
// Get new address of the JP instruction's address parameter
//.........这里部分代码省略.........
开发者ID:suppertails66,项目名称:tales,代码行数:101,代码来源:EditableLevelObjectEntryGroups.cpp
示例13: NotEnoughSpaceException
void TailsAdvBank0Hacks::addUseAllInventoryHack(
WritableROM& rom) {
// Find free space
FreeSpaceList::iterator spaceIt
= rom.freeSpace().getFreeSpace(allInventoryHackCodeDataSize);
// Throw if not enough space
if (spaceIt == rom.freeSpace().freeSpaceList().end()) {
throw NotEnoughSpaceException(TALES_SRCANDLINE,
"TailsAdvBank0Hacks::addUseAllInventoryHack("
"WritableROM&)",
allInventoryHackCodeDataSize);
}
Taddress writeAddress = spaceIt->address();
rom.freeSpace().claimSpace(spaceIt,
allInventoryHackCodeDataSize);
// std::cout << writeAddress << std::endl;
// Write main code and data
rom.directWrite(writeAddress,
allInventoryHackMainData,
allInventoryHackMainLength);
// Fill in addresses of data tables
ByteConversion::toBytes(LoadedROM::directToBankedAddress(writeAddress
+ allInventoryHackMainTable1Offset),
rom.directWrite(writeAddress
+ allInventoryHackMainTable1ReferenceOffset),
ByteSizes::uint16Size,
EndiannessTypes::little,
SignednessTypes::nosign);
ByteConversion::toBytes(LoadedROM::directToBankedAddress(writeAddress
+ allInventoryHackMainTable2Offset),
rom.directWrite(writeAddress
+ allInventoryHackMainTable2ReferenceOffset),
ByteSizes::uint16Size,
EndiannessTypes::little,
SignednessTypes::nosign);
// Add trigger 1
rom.directWrite(allInventoryHackTrigger1Address,
allInventoryHackTrigger1Data,
allInventoryHackTrigger1Length);
// Fill in bank
ByteConversion::toBytes(LoadedROM::directToBankNum(writeAddress
+ allInventoryHackMainCodeStartOffset),
rom.directWrite(
allInventoryHackTrigger1Address
+ allInventoryHackTrigger1BankReferenceOffset),
ByteSizes::uint8Size,
EndiannessTypes::little,
SignednessTypes::nosign);
// Fill in address
ByteConversion::toBytes(LoadedROM::directToBankedAddress(writeAddress
+ allInventoryHackMainCodeStartOffset),
rom.directWrite(
allInventoryHackTrigger1Address
+ allInventoryHackTrigger1AddressReferenceOffset),
ByteSizes::uint16Size,
EndiannessTypes::little,
SignednessTypes::nosign);
// Add trigger 2
rom.directWrite(allInventoryHackTrigger2Address,
allInventoryHackTrigger2Data,
allInventoryHackTrigger2Length);
// Fill in bank
ByteConversion::toBytes(LoadedROM::directToBankNum(writeAddress
+ allInventoryHackMainCodeStartOffset),
rom.directWrite(
allInventoryHackTrigger2Address
+ allInventoryHackTrigger2BankReferenceOffset),
ByteSizes::uint8Size,
EndiannessTypes::little,
SignednessTypes::nosign);
// Fill in address
ByteConversion::toBytes(LoadedROM::directToBankedAddress(writeAddress
+ allInventoryHackMainCodeStartOffset),
rom.directWrite(
allInventoryHackTrigger2Address
+ allInventoryHackTrigger2AddressReferenceOffset),
ByteSizes::uint16Size,
EndiannessTypes::little,
SignednessTypes::nosign);
// Add initializer 1
rom.directWrite(allInventoryHackInitializer1Address,
allInventoryHackInitializer1Data,
//.........这里部分代码省略.........
开发者ID:suppertails66,项目名称:tales,代码行数:101,代码来源:TailsAdvBank0Hacks.cpp
注:本文中的WritableROM类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论