mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Added syntax to RAM_POS for conditionally including a source file
This commit is contained in:
@@ -147,7 +147,7 @@ endif
|
||||
|
||||
AS = $(CROSS)as
|
||||
CC := $(RECOMP_DIR)cc
|
||||
CPP := cpp -P -Wno-trigraphs
|
||||
CPP := cpp -P -Wno-trigraphs -I include
|
||||
LD = $(CROSS)ld
|
||||
OBJDUMP = $(CROSS)objdump
|
||||
# Pad to 12MB if matching, otherwise build to a necessary minimum of 1.04KB
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
/*** This file should contain defines used for modded repos. ***/
|
||||
|
||||
/* -------------------------Memory------------------------ */
|
||||
//#define EXPANSION_PAK_SUPPORT // Allow the game to use the expansion pak if it's inserted.
|
||||
|
||||
#endif // CONFIG_H
|
||||
+2
-7
@@ -50,14 +50,9 @@ extern MemoryPoolSlot gMainMemoryPool;
|
||||
* Official Name: mmInit
|
||||
*/
|
||||
void init_main_memory_pool(void) {
|
||||
s32 ramEnd;
|
||||
gNumberOfMemoryPools = -1;
|
||||
if (FALSE) {
|
||||
ramEnd = EXTENDED_RAM_END; //Value from JFG, not required to match
|
||||
} else {
|
||||
ramEnd = RAM_END;
|
||||
}
|
||||
new_memory_pool(&gMainMemoryPool, ramEnd - (s32)(&gMainMemoryPool), MAIN_POOL_SLOT_COUNT);
|
||||
if (1) {} // Fakematch
|
||||
new_memory_pool(&gMainMemoryPool, RAM_END - (s32)(&gMainMemoryPool), MAIN_POOL_SLOT_COUNT);
|
||||
set_free_queue_state(2);
|
||||
gFreeQueueCount = 0;
|
||||
}
|
||||
|
||||
+6
-1
@@ -4,9 +4,14 @@
|
||||
#include "structs.h"
|
||||
#include "types.h"
|
||||
#include "macros.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef EXPANSION_PAK_SUPPORT
|
||||
#define RAM_END 0x80800000
|
||||
#else
|
||||
#define RAM_END 0x80400000
|
||||
#define EXTENDED_RAM_END 0x80800000
|
||||
#endif
|
||||
|
||||
#define MAIN_POOL_SLOT_COUNT 1600
|
||||
|
||||
// Animation related?
|
||||
|
||||
@@ -46,6 +46,8 @@ class GenerateLD:
|
||||
self.gen_comment('linker script generated by generate_ld.py')
|
||||
self.gen_comment('If you want to make any changes, then edit the generate_ld.py script!')
|
||||
self.gen_newline()
|
||||
self.gen_line('#include "config.h"')
|
||||
self.gen_newline()
|
||||
self.gen_line('OUTPUT_ARCH (mips)')
|
||||
self.gen_newline()
|
||||
self.gen_sections()
|
||||
@@ -85,7 +87,12 @@ class GenerateLD:
|
||||
self.gen_line('.main __FUNC_RAM_START : AT(romPos) SUBALIGN(16)')
|
||||
self.gen_open_block()
|
||||
for file in self.files:
|
||||
condition = file[4]
|
||||
if condition != None:
|
||||
self.gen_line('#if ' + condition)
|
||||
self.gen_line(file[0] + '(.text);')
|
||||
if condition != None:
|
||||
self.gen_line('#endif')
|
||||
self.gen_close_block()
|
||||
self.gen_line('romPos += SIZEOF(.main);')
|
||||
self.gen_newline()
|
||||
@@ -102,8 +109,13 @@ class GenerateLD:
|
||||
self.gen_line('.data . : AT(romPos) SUBALIGN(16)')
|
||||
self.gen_open_block()
|
||||
for file in self.files:
|
||||
condition = file[4]
|
||||
if file[0] not in LATE_DATA_FILES:
|
||||
if condition != None:
|
||||
self.gen_line('#if ' + condition)
|
||||
self.gen_line(file[0] + '(.data);')
|
||||
if condition != None:
|
||||
self.gen_line('#endif')
|
||||
for file in LATE_DATA_FILES:
|
||||
self.gen_line(file + '(.data);')
|
||||
self.gen_close_block()
|
||||
@@ -115,12 +127,17 @@ class GenerateLD:
|
||||
self.gen_open_block()
|
||||
for file in self.files:
|
||||
f = file[0]
|
||||
condition = file[4]
|
||||
if f not in LATE_DATA_FILES:
|
||||
if condition != None:
|
||||
self.gen_line('#if ' + condition)
|
||||
self.gen_line(f + '(.rodata);')
|
||||
fname = f[f.rindex('/')+1:f.rindex('.')]
|
||||
testName = DATA_DIR + '/' + fname + '.rodata.s'
|
||||
if FileUtil.does_file_exist(testName):
|
||||
self.gen_line(BUILD_DIR + '/data/' + fname + '.rodata.o(.rodata);')
|
||||
if condition != None:
|
||||
self.gen_line('#endif')
|
||||
for f in LATE_DATA_FILES:
|
||||
self.gen_line(f + '(.rodata);')
|
||||
fname = f[f.rindex('/')+1:f.rindex('.')]
|
||||
@@ -145,8 +162,13 @@ class GenerateLD:
|
||||
self.gen_line('.bss.noload . (NOLOAD): SUBALIGN(4)')
|
||||
self.gen_open_block()
|
||||
for file in self.files:
|
||||
condition = file[4]
|
||||
if file[0] not in BSS_LIB_ORDER_FILES:
|
||||
if condition != None:
|
||||
self.gen_line('#if ' + condition)
|
||||
self.gen_line(file[0] + '(.bss);')
|
||||
if condition != None:
|
||||
self.gen_line('#endif')
|
||||
for file in BSS_LIB_ORDER_FILES:
|
||||
self.gen_line(file + '(.bss);')
|
||||
self.gen_close_block()
|
||||
@@ -205,7 +227,7 @@ class GenerateLD:
|
||||
|
||||
def append_files(self, files, extensions, directory, outputDir):
|
||||
filenames = FileUtil.get_filenames_from_directory_recursive(directory, extensions)
|
||||
regex = r'[\/][*]+\s*RAM_POS:\s*((?:0x)[0-9a-fA-F]+|(?:[Aa][Uu][Tt][Oo]))\s*[*]+[\/]'
|
||||
regex = r'[\/][*]+\s*RAM_POS:\s*((?:0x)[0-9a-fA-F]+|(?:[Aa][Uu][Tt][Oo]))\s*(?:if\s*(.*))?\s*[*]+[\/]'
|
||||
for filename in filenames:
|
||||
with open(directory + '/' + filename, 'r') as inFile:
|
||||
notDone = True
|
||||
@@ -217,9 +239,10 @@ class GenerateLD:
|
||||
continue
|
||||
matchedGroups = matches.groups()
|
||||
ramPos = matchedGroups[0]
|
||||
condition = matchedGroups[1]
|
||||
if ramPos.lower() == 'auto':
|
||||
ramPos = '800FFFF0'
|
||||
files.append((outputDir + filename[:-2] + '.o', '', ramPos, 0))
|
||||
files.append((outputDir + filename[:-2] + '.o', '', ramPos, 0, condition))
|
||||
break
|
||||
|
||||
def get_code_files(self):
|
||||
|
||||
Reference in New Issue
Block a user