Update quickplay module (#38)
* Migrate to use the REL loading dol patch from aprilwade's randomprime. * Migrate Quickplay module to use the Pwootage's PrimeAPI2 * Add Quickplay module for Echoes NTSCpull/39/head
parent
dad9631099
commit
9e0842e03b
Binary file not shown.
@ -0,0 +1,2 @@ |
||||
0x8000207c rel_loader_hook |
||||
0x8036F8BC PPCSetFpIEEEMode |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@ |
||||
0x8000207c rel_loader_hook |
||||
0x803599e4 PPCSetFpIEEEMode |
Binary file not shown.
@ -0,0 +1,2 @@ |
||||
0x8000207c rel_loader_hook |
||||
0x803704ec PPCSetFpIEEEMode |
Binary file not shown.
@ -0,0 +1,2 @@ |
||||
0x8000207c rel_loader_hook |
||||
0x8035712c PPCSetFpIEEEMode |
Binary file not shown.
@ -0,0 +1,106 @@ |
||||
#ifndef CDOLHEADER_H |
||||
#define CDOLHEADER_H |
||||
|
||||
#include <Common/FileIO/IOutputStream.h> |
||||
#include <Common/FileIO/IInputStream.h> |
||||
|
||||
class SDolHeader |
||||
{ |
||||
public: |
||||
static const size_t kNumTextSections = 7; |
||||
static const size_t kNumDataSections = 11; |
||||
static const size_t kNumSections = kNumTextSections + kNumDataSections; |
||||
|
||||
struct Section |
||||
{ |
||||
uint32 Offset; |
||||
uint32 BaseAddress; |
||||
uint32 Size; |
||||
|
||||
bool IsEmpty() const { |
||||
return Size == 0; |
||||
} |
||||
}; |
||||
|
||||
Section Sections[kNumSections]; |
||||
uint32 BssAddress; |
||||
uint32 BssSize; |
||||
uint32 EntryPoint; |
||||
|
||||
explicit SDolHeader(IInputStream& rInput) |
||||
{ |
||||
for (size_t i = 0; i < kNumSections; ++i) |
||||
{ |
||||
Sections[i].Offset = rInput.ReadLong(); |
||||
} |
||||
for (size_t i = 0; i < kNumSections; ++i) |
||||
{ |
||||
Sections[i].BaseAddress = rInput.ReadLong(); |
||||
} |
||||
for (size_t i = 0; i < kNumSections; ++i) |
||||
{ |
||||
Sections[i].Size = rInput.ReadLong(); |
||||
} |
||||
BssAddress = rInput.ReadLong(); |
||||
BssSize = rInput.ReadLong(); |
||||
EntryPoint = rInput.ReadLong(); |
||||
} |
||||
|
||||
void Write(IOutputStream& rOutput) const |
||||
{ |
||||
for (size_t i = 0; i < kNumSections; ++i) |
||||
{ |
||||
rOutput.WriteLong(Sections[i].Offset); |
||||
} |
||||
for (size_t i = 0; i < kNumSections; ++i) |
||||
{ |
||||
rOutput.WriteLong(Sections[i].BaseAddress); |
||||
} |
||||
for (size_t i = 0; i < kNumSections; ++i) |
||||
{ |
||||
rOutput.WriteLong(Sections[i].Size); |
||||
} |
||||
rOutput.WriteLong(BssAddress); |
||||
rOutput.WriteLong(BssSize); |
||||
rOutput.WriteLong(EntryPoint); |
||||
} |
||||
|
||||
bool AddTextSection(uint32 address, uint32 fileOffset, uint32 size) |
||||
{ |
||||
if ((size & 0x1f) != 0) |
||||
{ |
||||
warnf("Unable to add text section: Size not 32-bit aligned."); |
||||
return false; |
||||
} |
||||
|
||||
for (size_t i = 0; i < kNumTextSections; ++i) |
||||
{ |
||||
if (Sections[i].IsEmpty()) |
||||
{ |
||||
Sections[i].BaseAddress = address; |
||||
Sections[i].Offset = fileOffset; |
||||
Sections[i].Size = size; |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
warnf("Unable to add text section: no empty section found."); |
||||
return false; |
||||
} |
||||
|
||||
uint32 OffsetForAddress(uint32 address) |
||||
{ |
||||
for (size_t i = 0; i < kNumSections; ++i) |
||||
{ |
||||
auto& sec = Sections[i]; |
||||
if (address > sec.BaseAddress && address < sec.BaseAddress + sec.Size) |
||||
{ |
||||
return sec.Offset + (address - sec.BaseAddress); |
||||
} |
||||
} |
||||
warnf("Unable to add section for address: %x", address); |
||||
return 0; |
||||
} |
||||
}; |
||||
|
||||
#endif // SDOLHEADER_H
|
Loading…
Reference in new issue