Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Weermann (TGE) committed Mar 21, 2020
1 parent 6b52a6e commit a544155
Show file tree
Hide file tree
Showing 17 changed files with 4,143 additions and 491 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

scripts/yakuza_gmd_testing\.1sc
releases/*
templates/ACAU/p5_acau_tbl.bt
scripts/P5_Stat_Extractor.1sc
templates/ACAU/p5_acau_enums.bt
templates/common/include.h
templates/common/types.h
templates/common/utils.h
templates/p5_gfd.bt
78 changes: 78 additions & 0 deletions scripts/copy_as_pcsx2_pnach.1sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//------------------------------------------------
//--- 010 Editor v8.0 Script File
//
// File:
// Authors:
// Version:
// Purpose:
// Category:
// History:
//------------------------------------------------

local int virtualAddress = 0x5A0330;

local int sectionIndex = 0;
local int sectionOffset = 0;
local int sectionSize = 0;

local int instructionCount = 0;
local int instructionIndex = 0;
local int instructionOffset = 0;

local int inFile = GetFileNum();
local int outFile = FileNew();

FileSelect( inFile );
LittleEndian();

if ( GetSelSize() == 0 )
{
// run template
RunTemplate( "elf.bt" );

// find text section
for ( sectionIndex = 0; sectionIndex < file.elf_header.e_shnum_NUMBER_OF_SECTION_HEADER_ENTRIES; sectionIndex++ )
{

if ( file.section_header_table.section_table_element[ sectionIndex ].s_name.s_name_str == ".text" )
{
// get the section start offset
sectionOffset = file.section_header_table.section_table_element[ sectionIndex ].s_offset;

// calculate number of instructions
instructionCount = file.section_header_table.section_table_element[ sectionIndex ].s_size / 4;

// write out each instruction
for ( instructionIndex = 0; instructionIndex < instructionCount; instructionIndex++ )
{
instructionOffset = instructionIndex * 4;
FPrintf( outFile, "patch=1,EE,%08X,word,%08X\n", virtualAddress + instructionOffset, ReadUInt( sectionOffset + instructionOffset ) );
}

break;
}
}
}
else
{
// get start offset
sectionOffset = GetSelStart();

// calculate number of instructions
instructionCount = GetSelSize() / 4;

// write out each instruction
for ( instructionIndex = 0; instructionIndex < instructionCount; instructionIndex++ )
{
instructionOffset = instructionIndex * 4;
//FPrintf( outFile, "patch=1,EE,%08X,word,%08X\n", virtualAddress + instructionOffset, ReadUInt( sectionOffset + instructionOffset ) );
FPrintf( outFile, "patch=1,EE,%08X,word,%08X\n", virtualAddress + instructionOffset, ReadUInt( sectionOffset + instructionOffset ) );
}
}

// copy to clipboard and close temporary file
FileSelect( outFile );
SetSelection( 0, FileSize() );
CutToClipboard();
FileClose();
FileSelect( inFile );
1 change: 1 addition & 0 deletions templates/common/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "common/types.h"


void PrintValueUInt( string name, u64 value )
{
PrintValueUIntEx( name, value, true );
Expand Down
90 changes: 90 additions & 0 deletions templates/dds3_sound.bt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
//------------------------------------------------
//--- 010 Editor v8.0 Binary Template
//
// File:
// Authors:
// Version:
// Purpose:
// Category:
// File Mask:
// ID Bytes:
// History:
//------------------------------------------------

#include "common/include.h"

typedef struct
{
u8 type;
u8 format;
u16 ID;
u32 fsize;
u32 code;
u32 dsize;
} p2sdfileheader;

typedef struct
{
u32 hdofs;
u32 hdsize;
u32 bdofs;
u32 bdsize;
u32 sqofs;
u32 sqsize;
u32 reqno;
u8 totaltimes;
u8 bgmtimes;
u8 songtimes;
u8 area;
} p2sdsoundheader;

typedef struct
{
u32 strsize;
u32 interleave;
u32 looppoint;
u8 mode;
u8 frequensy;
u8 dsp;
u8 reserve;
} p2sdadpcmheader;

typedef struct
{
p2sdfileheader FileHeader;
p2sdsoundheader SoundHeader;
} TFile;

TFile File;

/*
p2sdfileheader:t171=172=s16
type:10,0,8;
format:10,8,8;
ID:9,16,16;
fsize:4,32,32;
code:173=ar0;0;3;10,64,32;
dsize:4,96,32;;
p2sdsoundheader:t174=175=s32
hdofs:4,0,32;
hdsize:4,32,32;
bdofs:4,64,32;
bdsize:4,96,32;
sqofs:4,128,32;
sqsize:4,160,32;
reqno:4,192,32;
totaltimes:11,224,8;
bgmtimes:11,232,8;
songtimes:11,240,8;
area:11,248,8;;
p2sdadpcmheader:t176=177=s16
strsize:4,0,32;
interleave:4,32,32;
looppoint:1,64,32;
mode:11,96,8;
frequensy:11,104,8;
dsp:2,112,8;
reserve:2,12
*/
93 changes: 93 additions & 0 deletions templates/gc_wii_rel.bt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
//------------------------------------------------
//--- 010 Editor v8.0 Binary Template
//
// File:
// Authors:
// Version:
// Purpose:
// Category:
// File Mask:
// ID Bytes:
// History:
//------------------------------------------------

#include "common/include.h"

BigEndian();

typedef struct
{
u32 id;
u32 nextModule;
u32 prevModule;
u32 numSections;
u32 sectionInfoOffset;
u32 nameOffset;
u32 nameSize;
u32 version;
u32 bssSize;
u32 relOffset;
u32 impOffset;
u32 impSize;
u8 prologSection;
u8 epilogSection;
u8 unresolvedSection;
u8 bssSection;
u32 prolog;
u32 epilog;
u32 unresolved;

if ( version >= 2 )
{
u32 align;
u32 bssAlign;
if ( version >= 3 )
{
u32 fixSize;
}
}

if ( impSize > 0 )
{
FSeek( impOffset );

local u32 impIndex;
local u32 impCount = impSize / 8;
for ( impIndex = 0; impIndex < impCount; ++impIndex )
{
struct
{
u32 moduleId;
u32 relOffset;
local u32 nextRelOffset;
if ( impIndex + 1 < impCount )
nextRelOffset = ReadInt( FTell() + 4 );
else
nextRelOffset = FileSize();

local u32 relCount = (nextRelOffset - relOffset) / 8;

FPush();
FSeek( relOffset );
struct TRELReloc relocs[relCount];
FPop();
} Imp;
}
}
} TRELModule;

typedef struct
{
u32 moduleId;
u32 relOffset;
} TRELImp;

typedef struct
{
u16 offset;
u8 type;
u8 section;
u32 symbolOffset;
} TRELReloc;

TRELModule File;
Loading

0 comments on commit a544155

Please sign in to comment.