Skip to content

Commit

Permalink
- Added support for Tengai Makyou Zero english translation. Based on …
Browse files Browse the repository at this point in the history
…DougRPG source code.

- Removed some unused variables.
  • Loading branch information
esmjanus committed Oct 24, 2017
1 parent f947b55 commit 4c925fd
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 14 deletions.
14 changes: 7 additions & 7 deletions dsp4emu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1267,9 +1267,9 @@ void DSP4_Op09()
if(sprite_type == 1)
{
int16 plane;
int16 car_left, car_right, car_left_a;
int16 focal_back, focal_front;
uint8 distance, id;
int16 car_left, car_right;//, car_left_a;
int16 focal_back;//, focal_front;
//uint8 distance, id;

// we already have 4 bytes we want
DSP4.in_count = 6+12;
Expand All @@ -1280,11 +1280,11 @@ void DSP4_Op09()
// filter inputs
project_y1 = DSP4_READ_WORD(0x00);
// 0x9000 = DSP4_READ_WORD(0x02);
id = DSP4.parameters[0x04];
distance = DSP4.parameters[0x05];
//id = DSP4.parameters[0x04];
//distance = DSP4.parameters[0x05];
focal_back = DSP4_READ_WORD(0x06);
focal_front = DSP4_READ_WORD(0x08);
car_left_a = DSP4_READ_WORD(0x0a);
//focal_front = DSP4_READ_WORD(0x08);
//car_left_a = DSP4_READ_WORD(0x0a);
car_left = DSP4_READ_WORD(0x0c);
plane = DSP4_READ_WORD(0x0e);
car_right = DSP4_READ_WORD(0x10);
Expand Down
42 changes: 37 additions & 5 deletions memmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ int CMemory::LoadROMMore(int TotalFileSize,int &retry_count)
int hi_score = ScoreHiROM (FALSE);
int lo_score = ScoreLoROM (FALSE);

uint8* RomHeader=ROM;
//uint8* RomHeader=ROM;

ExtendedFormat=NOPE;

Expand Down Expand Up @@ -716,7 +716,7 @@ int CMemory::LoadROMMore(int TotalFileSize,int &retry_count)
ExtendedFormat = BIGFIRST;
hi_score=swappedhirom;
lo_score=swappedlorom;
RomHeader=ROM+0x400000;
//RomHeader=ROM+0x400000;
}
else
ExtendedFormat = SMALLFIRST;
Expand Down Expand Up @@ -3305,13 +3305,13 @@ void CMemory::JumboLoROMMap (bool8 Interleaved)
int i;

uint32 OFFSET0 = 0x400000;
uint32 OFFSET1 = 0x400000;
//uint32 OFFSET1 = 0x400000;
uint32 OFFSET2 = 0x000000;

if (Interleaved)
{
OFFSET0 = 0x000000;
OFFSET1 = 0x000000;
//OFFSET1 = 0x000000;
OFFSET2 = CalculatedSize-0x400000; //changed to work with interleaved DKJM2.
}
// Banks 00->3f and 80->bf
Expand Down Expand Up @@ -3399,6 +3399,24 @@ void CMemory::JumboLoROMMap (bool8 Interleaved)
WriteProtectROM ();
}

static uint32 map_mirror (uint32 size, uint32 pos)
{
// from bsnes
if (size == 0)
return (0);
if (pos < size)
return (pos);

uint32 mask = 1 << 31;
while (!(pos & mask))
mask >>= 1;

if (size <= (pos & mask))
return (map_mirror(size, pos - mask));
else
return (mask + map_mirror(size - mask, pos - mask));
}

void CMemory::SPC7110HiROMMap ()
{
int c;
Expand Down Expand Up @@ -3458,7 +3476,21 @@ void CMemory::SPC7110HiROMMap ()
BlockIsROM [i + 0x400] = BlockIsROM [i + 0xc00] = TRUE;
}
}


uint32 p, addr;

for (c = 0x40; c <= 0x4f; c++)
{
for (i = 0x0000; i <= 0xffff; i += 0x1000)
{
p = (c << 4) | (i >> 12);
addr = (c - 0x40) << 16;
Map[p] = ROM + 0x600000 + map_mirror(CalculatedSize, addr);
BlockIsROM[p] = TRUE;
BlockIsRAM[p] = FALSE;
}
}

for (c = 0; c < 0x10; c++)
{
Map [0x500 + c] = (uint8 *) MAP_SPC7110_DRAM;
Expand Down
4 changes: 3 additions & 1 deletion spc7110dec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void SPC7110Decomp::write(uint8 data) {
}

uint8 SPC7110Decomp::dataread() {
unsigned size = memory_cartrom_size() - 0x100000;
unsigned size = memory_cartrom_size() - programmrom_size;
while(decomp_offset >= size) decomp_offset -= size;
return memory_cartrom_read(0x100000 + decomp_offset++);
}
Expand Down Expand Up @@ -519,6 +519,8 @@ SPC7110Decomp::SPC7110Decomp() {
+ map(3, 24) + map(2, 16) + map(1, 8) + map(0, 0);
#undef map
}

programmrom_size = (memory_cartrom_size() > 0x500000) ? 0x200000 : 0x100000;
}

SPC7110Decomp::~SPC7110Decomp() {
Expand Down
2 changes: 2 additions & 0 deletions spc7110dec.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class SPC7110Decomp {
unsigned decomp_mode;
unsigned decomp_offset;

unsigned programmrom_size;

//read() will spool chunks half the size of decomp_buffer_size
enum { decomp_buffer_size = SPC7110_DECOMP_BUFFER_SIZE }; //must be >= 64, and must be a power of two
uint8 *decomp_buffer;
Expand Down
3 changes: 2 additions & 1 deletion spc7110emu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void SPC7110::reset() {
}

unsigned SPC7110::datarom_addr(unsigned addr) {
unsigned size = memory_cartrom_size() - 0x100000;
unsigned size = memory_cartrom_size() - programmrom_size;
while(addr >= size) addr -= size;
return addr + 0x100000;
}
Expand Down Expand Up @@ -642,4 +642,5 @@ void SPC7110::mmio_write(unsigned addr, uint8 data) {
}

SPC7110::SPC7110() {
programmrom_size = (memory_cartrom_size() > 0x500000) ? 0x200000 : 0x100000;
}
2 changes: 2 additions & 0 deletions spc7110emu.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class SPC7110 {
unsigned rtc_index;

static const unsigned months[12];

unsigned programmrom_size;
};

#endif

0 comments on commit 4c925fd

Please sign in to comment.