diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index f2e2111b..00000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: Release - -on: - push: - tags: - - 'v*' - -jobs: - create-release: - name: Create Release - # needs: [ci] - if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - steps: - - name: Fetch Build Artifacts - uses: actions/download-artifact@v4 - with: - path: artifacts - - name: Calculate Variables - id: vars - run: | - echo "ref_name_without_v=$(echo ${GITHUB_REF_NAME} | cut -c2-)" >>$GITHUB_OUTPUT - - name: Create Release - id: create_release - uses: softprops/action-gh-release@v2 - with: - draft: false - prerelease: false - name: Dethrace ${{ steps.vars.outputs.ref_name_without_v }} - generate_release_notes: true - files: | - artifacts/** diff --git a/DIAGNOST.TXT b/DIAGNOST.TXT deleted file mode 100644 index 1413096a..00000000 --- a/DIAGNOST.TXT +++ /dev/null @@ -1,5 +0,0 @@ -DIAGNOSTIC OUTPUT -Date / time : Mon Mar 24 16 : 32 : 33 1997 - - - 0.00: FATAL ERROR: This .exe must have KEYBOARD.COK in the DATA folder. diff --git a/a.out b/a.out deleted file mode 100755 index f69fdd82..00000000 Binary files a/a.out and /dev/null differ diff --git a/carma-palette.tga b/carma-palette.tga deleted file mode 100644 index 228f1db4..00000000 Binary files a/carma-palette.tga and /dev/null differ diff --git a/clang-all b/clang-all deleted file mode 100644 index f2744b0c..00000000 --- a/clang-all +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# -# clang-format-all: a tool to run clang-format on an entire project -# Copyright (C) 2016 Evan Klitzke -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -function usage { - echo "Usage: $0 DIR..." - exit 1 -} - -if [ $# -eq 0 ]; then - usage -fi - -# Variable that will hold the name of the clang-format command -FMT="" - -# Some distros just call it clang-format. Others (e.g. Ubuntu) are insistent -# that the version number be part of the command. We prefer clang-format if -# that's present, otherwise we work backwards from highest version to lowest -# version. -for clangfmt in clang-format{,-{4,3}.{9,8,7,6,5,4,3,2,1,0}}; do - if which "$clangfmt" &>/dev/null; then - FMT="$clangfmt" - break - fi -done - -# Check if we found a working clang-format -if [ -z "$FMT" ]; then - echo "failed to find clang-format" - exit 1 -fi - -# Check all of the arguments first to make sure they're all directories -for dir in "$@"; do - if [ ! -d "${dir}" ]; then - echo "${dir} is not a directory" - usage - fi -done - -# Find a dominating file, starting from a given directory and going up. -find-dominating-file() { - if [ -r "$1"/"$2" ]; then - return 0 - fi - if [ "$1" = "/" ]; then - return 1 - fi - find-dominating-file "$(realpath "$1"/..)" "$2" - return $? -} - -# Run clang-format -i on all of the things -for dir in "$@"; do - pushd "${dir}" &>/dev/null - if ! find-dominating-file . .clang-format; then - echo "Failed to find dominating .clang-format starting at $PWD" - continue - fi - find . \ - \( -name '*.c' \ - -o -name '*.cc' \ - -o -name '*.cpp' \ - -o -name '*.h' \ - -o -name '*.hh' \ - -o -name '*.hpp' \) \ - -exec "${FMT}" -i '{}' \; - popd &>/dev/null -done \ No newline at end of file diff --git a/extern.py b/extern.py deleted file mode 100755 index d1582916..00000000 --- a/extern.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python3 -u - -import sys -import os - -# Usage: find src/DETHRACE -name "*.h" | xargs ./extern.py - -path = 'DETHRACE/' -codegen_path = '/Users/jeff/temp/c1_output2/DETHRACE/source' - -for file_name in sys.argv[1:]: - # print (file_name) - # continue - - f = open(file_name, 'r') - - just_file_name = file_name[file_name.index(path)+len(path):] - - try: - codegen_f = open(codegen_path + '/' + just_file_name, 'r') - except: - print('WARNING could not load file', codegen_path + '/' + just_file_name) - continue - - in_gvs = False - stripped_existing = False - codegen_gvs = [] - while True: - line = codegen_f.readline() - - if line.startswith('extern'): - codegen_gvs.append(line) - - if line == '': - break - - appended = False - lines = [] - while True: - line = f.readline() - - if line == '': - break - - # first function decl - if not appended: - if (line != '' and line[0].isalpha() and '(' in line and line.endswith(');\n') - or line == '#endif\n'): - if stripped_existing == True: - print('pop') - lines.pop() # remove the extra newline - for codegen_gv in codegen_gvs: - lines.append(codegen_gv) - lines.append('\n') - appended = True - - if not line.startswith('extern'): - lines.append(line) - else: - stripped_existing = True - - print(lines) - # in_function = False - # lines = [] - - # while True: - # line = f.readline() - # if line == '': - # break - - # if line[0].isalpha() and '(' in line and line[-2] == '{': - # in_function = True - - outF = open(file_name, "w") - outF.writelines(lines) - outF.close() - - - - - diff --git a/lib/BRender-v1.3.2 b/lib/BRender-v1.3.2 index d440de50..1e3d22b0 160000 --- a/lib/BRender-v1.3.2 +++ b/lib/BRender-v1.3.2 @@ -1 +1 @@ -Subproject commit d440de507a070637eb134ae6aafa5dee36baf6b7 +Subproject commit 1e3d22b0bee8b649ba0db9bdbe04c1a5eebb2d7f diff --git a/misc-strings b/misc-strings deleted file mode 100644 index f2522668..00000000 --- a/misc-strings +++ /dev/null @@ -1,251 +0,0 @@ -0: Invulnerable! -1: Timer frozen -2: Mirror on -3: Mirror off -4: Repairing for free -5: Repair cost: -6: Repair Obstructed -7: Recovery Cost: -8: Opponents visible on map -9: Opponents not visible on map -10: Every opponent wasted!! -11: Running demo game -12: credits -13: credit -14: Lost -15: Empty -16: PROFIT -17: LOSS -18: KILLS -19: WASTED -20: LAP -21: CP -22: Completion bonus: -23: Time bonus: -24: Let the carnage continue... -25: Nice and fluffy mode -26: Every ped murdered!! -27: Your current rank is -28: Retail: -29: You pay: -30: Refund: -31: Credits: -32: Yours already -33: You got it! -34: No other cars to choose from yet -35: Original driver was -36: Your original car -37: ACTION REPLAY UNAVAILABLE -38: Standard camera -39: Panning camera -40: Action-tracking camera -41: Instant repair -42: Final lap -43: Wrong checkpoint! -44: Bad boy! -45: credit fine -46: WASTED -47: PRFT -48: Recovering for free -49: Bad girl! -50: No car textures -51: Transparent car textures only -52: Full car textures -53: No road textures -54: Road textures -55: No wall textures -56: Linear wall textures -57: Best wall textures -58: has joined the game -59: DRIVEN TO DESTRUCTION -60: CAR CRUSHER -61: CARNAGE ACCUMULATOR -62: CHECKPOINT STAMPEDE -63: SUDDEN DEATH -64: TERMINAL TAG -65: FOX 'N' HOUNDS -66: UNUSED -67: UNUSED -68: STARTING -69: READY -70: PLAYING -71: CLOSED -72: OPEN -73: GAME TERMINATED BY HOST! -74: has left the game -75: CAN'T SAVE A GAME IN NETWORK PLAY (NICE TRY...) -76: SORRY, BUT NETWORK PLAY IS NOT AVAILABLE (CHECK CABLING, DRIVERS ETC) -77: UNKNOWN -78: READY -79: LOADING -80: IN WRECKS GALLERY -81: IN RACE SUMMARY -82: NOT RESPONDING -83: RACING -84: IN MAIN MENU -85: RECOVERING -86: IN ACTION REPLAY -87: HOST ABANDONED RACE! -88: HOST -89: SORRY, BUT YOU'RE TOO LATE! -90: IS NO LONGER RESPONDING -91: PANIC!! HOST HAS DISAPPEARED! -92: IN -93: OUT -94: CREDITS -95: CAN'T AFFORD TO REPAIR! -96: CAN'T AFFORD TO RECOVER! -97: RECOVERY IN -98: SECOND -99: SECONDS -100: Track appears very quickly -101: Track appears quite quickly -102: Track appears quite late -103: Track appears very late -104: No shadows -105: Shadow under own car -106: Shadow under main cars -107: Shadow under all cars -108: Sky texture on -109: Sky texture off -110: There's no sky texture for this race -111: Depth cueing on -112: Depth cueing off -113: There's no depth cueing for this race -114: Yon increased to %d -115: Yon decreased to %d -116: Fewest sounds -117: Partial sound -118: All sounds -119: Car simplification level %d -120: Accessories on -121: Accessories off -122: Smoke on -123: Smoke off -124: Net games always accessorized -125: RECOVERY CANCELLED -126: AND -127: WASTED EACH OTHER -128: RACE CHANGED DURING LOADING. PLEASE TRY TO JOIN GAME AGAIN. -129: WRONG TEXT.TXT -130: WRONG TEXT.TXT -131: WRONG TEXT.TXT -132: WRONG TEXT.TXT -133: WRONG TEXT.TXT -134: WRONG TEXT.TXT -135: WRONG TEXT.TXT -136: WRONG TEXT.TXT -137: WRONG TEXT.TXT -138: WRONG TEXT.TXT -139: WRONG TEXT.TXT -140: WRONG TEXT.TXT -141: WRONG TEXT.TXT -142: WRONG TEXT.TXT -143: WRONG TEXT.TXT -144: WRONG TEXT.TXT -145: WRONG TEXT.TXT -146: WRONG TEXT.TXT -147: WRONG TEXT.TXT -148: WRONG TEXT.TXT -149: WRONG TEXT.TXT -150: Accelerate -151: Brake/rev -152: Turn left -153: Turn right -154: Handbrake -155: Repair -156: Recover -157: Action replay -158: Wheelspin -159: Cockpit toggle -160: Look left -161: Look forward -162: Look right -163: Map toggle -164: Buy Armour -165: Buy Power -166: Buy Offense -167: Send Message -168: WRONG TEXT.TXT -169: WRONG TEXT.TXT -170: Car added to change car list -171: wasted by -172: COMMITTED SUICIDE -173: WASTED -174: YOU'RE ALREADY AT MAX! -175: ARMOUR STRENGTHENED -176: ENGINE POWER INCREASED -177: INCREASED OFFENSIVE -178: ONLY AVAILABLE IN NET GAMES -179: CAN'T AFFORD IT (% CREDITS) -180: TARGET -181: TARGET -182: TARGET -183: LIMIT -184: IS OUT -185: IS IT -186: HA HA YOU'RE IT! -187: IS NOW THE FOX -188: YOU'RE THE FOX! -189: IS THE WINNER -190: UNAVAILABLE IN DEMO -191: ENTER NAME -192: NOT ENOUGH MEMORY -193: LOW MEMORY MODE INVOKED -194: FIGHT TO THE DEATH - LAST SURVIVOR IS THE WINNER. A TRUE DERBY OF DESTRUCTION. -195: CONTINUOUS METAL WRECKING MAYHEM. WASTE YOUR OPPONENTS TO GET POINTS, LOSE A POINT IF YOU WASTE YOURSELF. -196: MASSACRE MODE: KILL MORE peds THAN ANYONE ELSE. -197: FIRST ONE TO GO THROUGH ALL CHECKPOINTS - IN ANY ORDER - IS THE WINNER. -198: LAST ONE THROUGH EACH CHECKPOINT - IN ORDER - IS KNOCKED OUT. -199: THE CLOCK TICKS UP FOR THE CAR THAT IS 'IT'. YOU'RE KNOCKED OUT WHEN IT REACHES THE LIMIT. -200: THE FOX'S CLOCK TICKS UP TOWARDS A TARGET. HIT HIM TO STOP HIS CLOCK AND START YOURS. -201: FIRST RACE: -202: RACES WILL CONTINUE DOWN THIS LIST -203: SUBSEQUENT RACES WILL BE RANDOM -204: THIS CAR ALREADY TAKEN BY -205: AVAILABLE -206: HOST -207: GAME TYPE -208: PLAYERS -209: STATUS -210: PLAYER -211: PLAYED -212: WON -213: SCORE -214: THE FOX CAN'T DO THAT! -215: ONLY 'IT' CAN DO THAT! -216: COP -217: WATCHING -218: RACE LEADER -219: THAT HALVED YOUR KILL COUNT! -220: THAT LOST YOU A CHECKPOINT! -221: BACK TO THE START! -222: THAT HALVED YOUR TIME! -223: PLEASE INSERT THE SplatPack CD -224: TRIED TO CHEAT! -225: MANAGED TO CHEAT!!! -226: MESSAGE SENT -227: ENTER MESSAGE: -228: PLEASE WAIT: HOST HAS PAUSED -229: YOU MUST USE THE APPROPRIATE SYSTEM CONTROL PANEL TO CALIBRATE JOYSTICKS ON THIS PLATFORM -230: SORRY, BUT YOU CANNOT CALIBRATE A JOYSTICK DURING A RACE WHEN PLAYING IN SVGA -231: HIT ESCAPE TO ABORT -232: HIT ESCAPE TO FINISH. JOYSTICK #1 SETTINGS WILL BE RETAINED -233: PLEASE MOVE JOYSTICK #1 TO THE TOP-LEFT AND HIT ANY KEY -234: PLEASE MOVE JOYSTICK #1 TO THE BOTTOM-RIGHT AND HIT ANY KEY -235: PLEASE MOVE JOYSTICK #1 TO THE CENTRE AND HIT ANY KEY -236: PLEASE MOVE JOYSTICK #2 TO THE TOP-LEFT AND HIT ANY KEY -237: PLEASE MOVE JOYSTICK #2 TO THE BOTTOM-RIGHT AND HIT ANY KEY -238: PLEASE MOVE JOYSTICK #2 TO THE CENTRE AND HIT ANY KEY -239: A NUMBER FOR YOU TO LOOK AT: -240: ANOTHER NUMBER FOR YOU TO LOOK AT: -241: 'IT' -242: TOO LATE TO CANCEL -243: Could not find the SplatPack CD -244: NOT AVAILABLE IN EVALUATION COPY -245: EVALUATION COPY -246: (null) -247: (null) -248: (null) -249: (null) -250: (null) \ No newline at end of file diff --git a/notes.txt b/notes.txt deleted file mode 100644 index 754336d2..00000000 --- a/notes.txt +++ /dev/null @@ -1,37 +0,0 @@ -gProgram_state {credits=0,credits_earned=0,credits_lost=0,view_change_start=0u,pratcam_move_start=0u,peds_killed=0,sausage_eater_mode=0,rank=0,loaded=0,last_slot=0,skill_level=1,parts_shop_visited=0,racing=0,cut_scene=0,saving=0,loading=0,dont_save_or_load=0,dont_load=0,mirror_on=1,prat_cam_on=1,cockpit_on=1,cockpit_image_index=0,current_render_left=0,current_render_top=7,current_render_right=320,current_render_bottom=168,frame_rate_headup=0,revs=0,music_volume=4,effects_volume=4,current_race_index=0,redo_race_index=0,credits_per_rank=0,game_completed=0,number_of_cars=0,current_car_index=0,which_view=eView_undefined,new_view=eView_undefined,pending_view=eView_undefined,old_view=eView_undefined,view_type=eVT_Scene,prog_status=eProg_idling,frank_or_anniness=eFrankie,auto_parts_reply=eAP_auto,current_car={index=0,disabled=0,driver=eDriver_local_human,car_master_actor=0,min_torque_squared= 0.0,break_off_radians_squared= 0.0,v={v={ 0.0, 0.0, 0.0}},old_v={v={ 0.0, 0.0, 0.0}},velocity_car_space={v={ 0.0, 0.0, 0.0}},oldmat={m={{ 0. tProgram_state -gRender_screen 0x2574C78:{_reserved=5265248u,identifier=0,pixels=0x769280,pixels_qualifier=43u,map=0,src_key={low=0u,high=0u},dst_key={low=0u,high=0u},key=0u,row_bytes=320,mip_offset=0,type=3u,flags=6u,copy_function=0u,base_x=0u,base_y=7u,width=320u,height=161u,origin_x=160,origin_y=80,user=0,stored=0} br_pixelmap * -gBack_screen 0x25749B8:{_reserved=5265248u,identifier=0,pixels=0x769280,pixels_qualifier=43u,map=0,src_key={low=0u,high=0u},dst_key={low=0u,high=0u},key=0u,row_bytes=320,mip_offset=0,type=3u,flags=6u,copy_function=0u,base_x=0u,base_y=0u,width=320u,height=200u,origin_x=0,origin_y=0,user=0,stored=0} br_pixelmap * - -#define S0 0 -#define S1 1 -#define BR_DIV(a, b) ((a) / (b)) -#define BR_MUL(a, b) ((a) * (b)) -#define DR_MUL3(a, b, c) ((a) * (b) * (c)) -#define DR_MUL4(a, b, c, d) ((a) * (b) * (c) * (d)) -float kWorld_scale = 6.9; -float kUnderwater_ability_factor = 0.6; -float kGravity = 10.0; -#define BR_SQRT(a) ((br_scalar)sqrt(a)) -#define BR_LENGTH2(a, b) ((br_scalar)sqrt((a) * (a) + (b) * (b))) -#define BR_LENGTH3(a, b, c) ((br_scalar)sqrt((a) * (a) + (b) * (b) + (c) * (c))) -#define BR_SQR(a) ((a) * (a)) -#define BR_SUB(a, b) ((a) - (b)) -#define BR_ABS(a) ((br_scalar)fabs(a)) -#define BrIntToScalar(i) ((br_scalar)(i)) -#define BrScalarToInt(i) ((int)(i)) -#define BrFloatToScalar(f) (f) -#define mHuman_car(c) (c->driver >= eDriver_net_human) -#define mLocal_car(c) (c->driver >= eDriver_local_human) -#define mCar_car(c) (car->driver > eDriver_non_car) -float kMax_damage_level = 100; -float kHandbrake_fail_damage = 60; -float kMin_omega = 0.05; -float kMin_speed = 0.000099999997; -#define R 0.5 -#define mSkid_min_v(c) (&gProgram_state.current_car == c ? 20.0 : 60.0) -float kMechanics_frame_period = 40.0; -#define BR_CONST_DIV(a, b) ((a) / (b)) - -for (wheel = 0; wheel < 4; ++wheel) { - //if (*(float*)((char*)car->susp_height + 2 * (wheel & 0xFFFFFFFE)) > (double)car->oldd[wheel] - car->susp_height[wheel >> 1] \ No newline at end of file diff --git a/palette.tga b/palette.tga deleted file mode 100644 index 228f1db4..00000000 Binary files a/palette.tga and /dev/null differ diff --git a/postproc.py b/postproc.py deleted file mode 100755 index 40caf156..00000000 --- a/postproc.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python3 -u - -import sys -import os - -def get_codegen_function_body(codegen_lines, function_header): - print('looking for', function_header) - for i in range(len(codegen_lines)): - #print(codegen_lines[i].strip()) - if function_header in codegen_lines[i]: - lines = [] - #lines.append('// IDA:' + codegen_lines[i-1][6:] + '\n') - j = 0 - while True: - j = j + 1 - if codegen_lines[i + j][0] == '}': - return lines - lines.append(codegen_lines[i+j] + '\n') - - - - print('failed to find', function_header.strip()) - -def get_codegen_function_ida(codegen_lines, function_header): - print('looking for', function_header) - for i in range(len(codegen_lines)): - if function_header in codegen_lines[i]: - return '// IDA:' + codegen_lines[i-1][6:] + '\n' - - print('failed to find', function_header.strip()) - - -path = 'BRSRC13' -replace_path = 'BRSRC13' - -for file_name in sys.argv[1:]: - f = open(file_name, 'r') - - just_file_name = file_name[file_name.index(path)+len(path):] - print(just_file_name) - try: - f2 = open('/Users/jeff/code/c1_codegen/' + replace_path + '/' + just_file_name, 'r') - except: - print('WARNING could not load file', just_file_name) - continue - codegen_lines = f2.read().splitlines() - - in_function = False - lines = [] - - while True: - line = f.readline() - if line == '': - break - - if line[0].isalpha() and '(' in line and line[-2] == '{': - in_function = True - function_lines = 0 - function_text = line[0:line.index('(')+1] - - codegen_result = get_codegen_function_ida(codegen_lines, function_text) - if codegen_result is not None: - lines.append(codegen_result) - seen_emptyline = False - seen_not_implemented = False - if line[0] == '}' and in_function == True: - in_function = False - if seen_not_implemented == True: - codegen_result = get_codegen_function_body(codegen_lines, function_text) - if codegen_result is not None: - lines = lines[:-function_lines+1] - lines.extend(codegen_result) - lines.append(' NOT_IMPLEMENTED();\n') - - if in_function: - function_lines = function_lines + 1 - if line == '\n': - seen_emptyline = True - if line.strip() == 'NOT_IMPLEMENTED();': - seen_not_implemented = True - lines.append(line) - - outF = open(file_name, "w") - outF.writelines(lines) - outF.close() - - - - - diff --git a/reccmp.svg b/reccmp.svg deleted file mode 100644 index c1cddf7c..00000000 --- a/reccmp.svg +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - CARM95.EXE91.19%91.19%Implemented: 100.00% (2379/2379)Accuracy: 91.19% diff --git a/reorder.py b/reorder.py deleted file mode 100755 index d71962d2..00000000 --- a/reorder.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python3 -u - -import sys -import os - -# Usage: find src/DETHRACE -name "*.c" | xargs ./reorder.py - -path = 'DETHRACE/' -codegen_path = '/Users/jeff/temp/c1_output2/DETHRACE/source' - -for file_name in sys.argv[1:]: - # print (file_name) - # continue - - f = open(file_name, 'r') - - just_file_name = file_name[file_name.index(path)+len(path):] - - try: - codegen_f = open(codegen_path + '/' + just_file_name, 'r') - except: - print('WARNING could not load file', codegen_path + '/' + just_file_name) - continue - - in_gvs = False - codegen_gvs = [] - while True: - line = codegen_f.readline() - - if ';' in line or '{' in line: - in_gvs = True - - if line.strip() == '': - if in_gvs == True: - in_gvs = False - break - - if in_gvs == True: - codegen_gvs.append(line) - - i = 0 - lines = f.readlines() - while True: - line = lines[i] - if ';' in line or '{' in line: - for codegen_gv in codegen_gvs: - lines.insert(i, codegen_gv) - i = i + 1 - lines.insert(i, "\n\n// END OF NEW ORDERING\n\n") - break - i = i + 1 - - - - # in_function = False - # lines = [] - - # while True: - # line = f.readline() - # if line == '': - # break - - # if line[0].isalpha() and '(' in line and line[-2] == '{': - # in_function = True - - - outF = open(file_name, "w") - outF.writelines(lines) - outF.close() - - - - - diff --git a/scancodes.py b/scancodes.py deleted file mode 100755 index 9c38758a..00000000 --- a/scancodes.py +++ /dev/null @@ -1,489 +0,0 @@ -#!/usr/bin/env python3 -u - -import sys -import os - -codes = { - 'SCANCODE_ESCAPE' : 0x01, -'SCANCODE_1' : 0x02, -'SCANCODE_2' : 0x03, -'SCANCODE_3' : 0x04, -'SCANCODE_4' : 0x05, -'SCANCODE_5' : 0x06, -'SCANCODE_6' : 0x07, -'SCANCODE_7' : 0x08, -'SCANCODE_8' : 0x09, -'SCANCODE_9' : 0x0A, -'SCANCODE_0' : 0x0B, -'SCANCODE_MINUS' : 0x0C, -'SCANCODE_EQUALS' : 0x0D, -'SCANCODE_BACK' : 0x0E, -'SCANCODE_TAB' : 0x0F, -'SCANCODE_Q' : 0x10, -'SCANCODE_W' : 0x11, -'SCANCODE_E' : 0x12, -'SCANCODE_R' : 0x13, -'SCANCODE_T' : 0x14, -'SCANCODE_Y' : 0x15, -'SCANCODE_U' : 0x16, -'SCANCODE_I' : 0x17, -'SCANCODE_O' : 0x18, -'SCANCODE_P' : 0x19, -'SCANCODE_LBRACKET' : 0x1A, -'SCANCODE_RBRACKET' : 0x1B, -'SCANCODE_RETURN' : 0x1C, -'SCANCODE_LCONTROL' : 0x1D, -'SCANCODE_A' : 0x1E, -'SCANCODE_S' : 0x1F, -'SCANCODE_D' : 0x20, -'SCANCODE_F' : 0x21, -'SCANCODE_G' : 0x22, -'SCANCODE_H' : 0x23, -'SCANCODE_J' : 0x24, -'SCANCODE_K' : 0x25, -'SCANCODE_L' : 0x26, -'SCANCODE_SEMICOLON' : 0x27, -'SCANCODE_APOSTROPHE' : 0x28, -'SCANCODE_GRAVE' : 0x29, -'SCANCODE_LSHIFT' : 0x2A, -'SCANCODE_BACKSLASH' : 0x2B, -'SCANCODE_Z' : 0x2C, -'SCANCODE_X' : 0x2D, -'SCANCODE_C' : 0x2E, -'SCANCODE_V' : 0x2F, -'SCANCODE_B' : 0x30, -'SCANCODE_N' : 0x31, -'SCANCODE_M' : 0x32, -'SCANCODE_COMMA' : 0x33, -'SCANCODE_PERIOD' : 0x34, -'SCANCODE_SLASH' : 0x35, -'SCANCODE_RSHIFT' : 0x36, -'SCANCODE_MULTIPLY' : 0x37, -'SCANCODE_LMENU' : 0x38, -'SCANCODE_SPACE' : 0x39, -'SCANCODE_CAPITAL' : 0x3A, -'SCANCODE_F1' : 0x3B, -'SCANCODE_F2' : 0x3C, -'SCANCODE_F3' : 0x3D, -'SCANCODE_F4' : 0x3E, -'SCANCODE_F5' : 0x3F, -'SCANCODE_F6' : 0x40, -'SCANCODE_F7' : 0x41, -'SCANCODE_F8' : 0x42, -'SCANCODE_F9' : 0x43, -'SCANCODE_F10' : 0x44, -'SCANCODE_NUMLOCK' : 0x45, -'SCANCODE_SCROLL' : 0x46, -'SCANCODE_NUMPAD7' : 0x47, -'SCANCODE_NUMPAD8' : 0x48, -'SCANCODE_NUMPAD9' : 0x49, -'SCANCODE_SUBTRACT' : 0x4A, -'SCANCODE_NUMPAD4' : 0x4B, -'SCANCODE_NUMPAD5' : 0x4C, -'SCANCODE_NUMPAD6' : 0x4D, -'SCANCODE_ADD' : 0x4E, -'SCANCODE_NUMPAD1' : 0x4F, -'SCANCODE_NUMPAD2' : 0x50, -'SCANCODE_NUMPAD3' : 0x51, -'SCANCODE_NUMPAD0' : 0x52, -'SCANCODE_DECIMAL' : 0x53, -'SCANCODE_OEM_102' : 0x56, -'SCANCODE_F11' : 0x57, -'SCANCODE_F12' : 0x58, -'SCANCODE_F13' : 0x64 , -'SCANCODE_F14' : 0x65 , -'SCANCODE_F15' : 0x66 , -'SCANCODE_KANA' : 0x70 , -'SCANCODE_ABNT_C1' : 0x73 , -'SCANCODE_CONVERT' : 0x79 , -'SCANCODE_NOCONVERT' : 0x7B , -'SCANCODE_YEN' : 0x7D , -'SCANCODE_ABNT_C2' : 0x7E , -'SCANCODE_NUMPADEQUALS' : 0x8D, -'SCANCODE_PREVTRACK' : 0x90 , -'SCANCODE_AT' : 0x91 , -'SCANCODE_COLON' : 0x92 , -'SCANCODE_UNDERLINE' : 0x93 , -'SCANCODE_KANJI' : 0x94 , -'SCANCODE_STOP' : 0x95 , -'SCANCODE_AX' : 0x96 , -'SCANCODE_UNLABELED' : 0x97 , -'SCANCODE_NEXTTRACK' : 0x99 , -'SCANCODE_NUMPADENTER' : 0x9C , -'SCANCODE_RCONTROL': 0x9D, -'SCANCODE_MUTE': 0xA0 , -'SCANCODE_CALCULATOR': 0xA1 , -'SCANCODE_PLAYPAUSE': 0xA2 , -'SCANCODE_MEDIASTOP': 0xA4 , -'SCANCODE_VOLUMEDOWN': 0xAE , -'SCANCODE_VOLUMEUP': 0xB0 , -'SCANCODE_WEBHOME': 0xB2 , -'SCANCODE_NUMPADCOMMA': 0xB3 , -'SCANCODE_DIVIDE': 0xB5 , -'SCANCODE_SYSRQ': 0xB7, -'SCANCODE_RCONTROL' : 0x9D, -'SCANCODE_RMENU': 0xB8 , -'SCANCODE_PAUSE': 0xC5 , -'SCANCODE_HOME': 0xC7 , -'SCANCODE_UP': 0xC8 , -'SCANCODE_PRIOR': 0xC9 , -'SCANCODE_LEFT': 0xCB , -'SCANCODE_RIGHT': 0xCD , -'SCANCODE_END': 0xCF , -'SCANCODE_DOWN': 0xD0 , -'SCANCODE_NEXT': 0xD1 , -'SCANCODE_INSERT': 0xD2 , -'SCANCODE_DELETE': 0xD3 -} - -keycodes = { - 'KEY_SHIFT_ANY' : 0, - 'KEY_ALT_ANY' : 1, - 'KEY_CTRL_ANY' : 2, - 'KEY_CTRL_ANY_2' : 3, - 'KEY_CAPSLOCK' : 4, - 'KEY_RSHIFT' : 5, - 'KEY_RALT' : 6, - 'KEY_RCTRL' : 7, - 'KEY_LSHIFT' : 8, - 'KEY_LALT' : 9, - 'KEY_LCTRL' : 10, - 'KEY_0' : 11, - 'KEY_1' : 12, - 'KEY_2' : 13, - 'KEY_3' : 14, - 'KEY_4' : 15, - 'KEY_5' : 16, - 'KEY_6' : 17, - 'KEY_7' : 18, - 'KEY_8' : 19, - 'KEY_9' : 20, - 'KEY_A' : 21, - 'KEY_B' : 22, - 'KEY_C' : 23, - 'KEY_D' : 24, - 'KEY_E' : 25, - 'KEY_F' : 26, - 'KEY_G' : 27, - 'KEY_H' : 28, - 'KEY_I' : 29, - 'KEY_J' : 30, - 'KEY_K' : 31, - 'KEY_L' : 32, - 'KEY_M' : 33, - 'KEY_N' : 34, - 'KEY_O' : 35, - 'KEY_P' : 36, - 'KEY_Q' : 37, - 'KEY_R' : 38, - 'KEY_S' : 39, - 'KEY_T' : 40, - 'KEY_U' : 41, - 'KEY_V' : 42, - 'KEY_W' : 43, - 'KEY_X' : 44, - 'KEY_Y' : 45, - 'KEY_Z' : 46, - 'KEY_GRAVE' : 47, - 'KEY_MINUS' : 48, - 'KEY_EQUALS' : 49, - 'KEY_BACKSPACE' : 50, - 'KEY_RETURN' : 51, - 'KEY_KP_ENTER' : 52, - 'KEY_TAB' : 53, - 'KEY_SLASH' : 54, - 'KEY_UNKNOWN_55' : 55, - 'KEY_SEMICOLON' : 56, - 'KEY_APOSTROPHE' : 57, - 'KEY_PERIOD' : 58, - 'KEY_COMMA' : 59, - 'KEY_LBRACKET' : 60, - 'KEY_RBRACKET' : 61, - 'KEY_BACKSLASH' : 62, - 'KEY_ESCAPE' : 63, - 'KEY_INSERT' : 64, - 'KEY_DELETE' : 65, - 'KEY_HOME' : 66, - 'KEY_END' : 67, - 'KEY_PAGEUP' : 68, - 'KEY_PAGEDOWN' : 69, - 'KEY_LEFT' : 70, - 'KEY_RIGHT' : 71, - 'KEY_UP' : 72, - 'KEY_DOWN' : 73, - 'KEY_KP_NUMLOCK' : 74, - 'KEY_KP_DIVIDE' : 75, - 'KEY_KP_MULTIPLY' : 76, - 'KEY_KP_MINUS' : 77, - 'KEY_KP_PLUS' : 78, - 'KEY_KP_PERIOD' : 79, - 'KEY_KP_EQUALS' : 80, - 'KEY_KP_0' : 81, - 'KEY_KP_1' : 82, - 'KEY_KP_2' : 83, - 'KEY_KP_3' : 84, - 'KEY_KP_4' : 85, - 'KEY_KP_5' : 86, - 'KEY_KP_6' : 87, - 'KEY_KP_7' : 88, - 'KEY_KP_8' : 89, - 'KEY_KP_9' : 90, - 'KEY_F1' : 91, - 'KEY_F2' : 92, - 'KEY_F3' : 93, - 'KEY_F4' : 94, - 'KEY_F5' : 95, - 'KEY_F6' : 96, - 'KEY_F7' : 97, - 'KEY_F8' : 98, - 'KEY_F9' : 99, - 'KEY_F10' : 100, - 'KEY_F11' : 101, - 'KEY_F12' : 102, - 'KEY_PRTSCN' : 103, - 'KEY_SCRLK' : 104, - 'KEY_PAUSE' : 105, - 'KEY_SPACE' : 106, -} - -stri = '''gScan_code[11] = 0xB; - gScan_code[13] = 3; - gScan_code[14] = 4; - gScan_code[12] = 2; - gScan_code[15] = 5; - gScan_code[17] = 7; - gScan_code[18] = 8; - gScan_code[16] = 6; - gScan_code[19] = 9; - gScan_code[21] = 0x1E; - gScan_code[22] = 0x30; - gScan_code[20] = 0xA; - gScan_code[23] = 0x2E; - gScan_code[25] = 0x12; - gScan_code[26] = 0x21; - gScan_code[24] = 0x20; - gScan_code[27] = 0x22; - gScan_code[29] = 0x17; - gScan_code[30] = 0x24; - gScan_code[28] = 0x23; - gScan_code[31] = 0x25; - gScan_code[33] = 0x32; - gScan_code[34] = 0x31; - gScan_code[32] = 0x26; - gScan_code[35] = 0x18; - gScan_code[37] = 0x10; - gScan_code[38] = 0x13; - gScan_code[36] = 0x19; - gScan_code[39] = 0x1F; - gScan_code[41] = 0x16; - gScan_code[42] = 0x2F; - gScan_code[40] = 0x14; - gScan_code[43] = 0x11; - gScan_code[44] = 0x2D; - gScan_code[45] = 0x15; - gScan_code[46] = 0x2C; - gScan_code[47] = 0x29; - gScan_code[48] = 0xC; - gScan_code[49] = 0xD; - gScan_code[50] = 0xE; - gScan_code[51] = 0x1C; - gScan_code[52] = 0x9C; - gScan_code[0] = 0x362A; - gScan_code[1] = 0xB838; - gScan_code[2] = 0x9D1D; - gScan_code[3] = 0x9D1D; - gScan_code[4] = 0x3A; - gScan_code[55] = 0x56; - gScan_code[54] = 0x35; - gScan_code[56] = 0x27; - gScan_code[59] = 0x33; - gScan_code[53] = 0xF; - gScan_code[58] = 0x34; - gScan_code[60] = 0x1A; - gScan_code[63] = 1; - gScan_code[57] = 0x28; - gScan_code[62] = 0x2B; - gScan_code[64] = 0xD2; - gScan_code[67] = 0xCF; - gScan_code[61] = 0x1B; - gScan_code[66] = 0xC7; - gScan_code[68] = 0xC9; - gScan_code[71] = 0xCD; - gScan_code[65] = 0xD3; - gScan_code[70] = 0xCB; - gScan_code[72] = 0xC8; - gScan_code[69] = 0xD1; - gScan_code[74] = 0x45; - gScan_code[73] = 0xD0; - gScan_code[75] = 0xB5; - gScan_code[76] = 0x37; - gScan_code[78] = 0x4E; - gScan_code[77] = 0x4A; - gScan_code[80] = 0; - gScan_code[79] = 0x53; - gScan_code[82] = 0x4F; - gScan_code[84] = 0x51; - gScan_code[81] = 0x52; - gScan_code[83] = 0x50; - gScan_code[86] = 0x4C; - gScan_code[88] = 0x47; - gScan_code[85] = 0x4B; - gScan_code[87] = 0x4D; - gScan_code[90] = 0x49; - gScan_code[92] = 0x3C; - gScan_code[89] = 0x48; - gScan_code[91] = 0x3B; - gScan_code[94] = 0x3E; - gScan_code[96] = 0x40; - gScan_code[93] = 0x3D; - gScan_code[95] = 0x3F; - gScan_code[98] = 0x42; - gScan_code[100] = 0x44; - gScan_code[97] = 0x41; - gScan_code[99] = 0x43; - gScan_code[102] = 0x58; - gScan_code[104] = 0x46; - gScan_code[101] = 0x57; - gScan_code[103] = 0; - gScan_code[105] = 0; - gScan_code[106] = 0x39; - gScan_code[5] = 0x36; - gScan_code[6] = 0xB8; - gScan_code[7] = 0x9D; - gScan_code[8] = 0x2A; - gScan_code[9] = 0x38; - gScan_code[10] = 0x1D;''' - -lines = stri.splitlines() -for l in lines: - parts = l.split('=') - # print(parts) - val = parts[1].strip().replace(';', '') - val_int = int(val, 16) - - parts2 = l.split(']') - # print(parts) - parts2[0] = parts2[0].strip() - # i = parts[0].index(']') - val_int2 = int(parts2[0][11:]) - - - code = -1 - keycode = -1 - printed = False - for c in codes: - if codes[c] == val_int: - code = c - - if code == -1: - code = val_int - - for c in keycodes: - if keycodes[c] == val_int2: - - # printed = True - keycode = c - # print(parts[0] + '= ' + str(val_int) + ';') - - if keycode == -1: - keycode = val_int2 - - print('gScan_code[' + str(keycode) + '][0] = ' + str(code) + ';') - - -stri = '''gScan_code[11][0] = SCANCODE_0; - gScan_code[13][0] = SCANCODE_2; - gScan_code[14][0] = SCANCODE_3; - gScan_code[12][0] = SCANCODE_1; - gScan_code[15][0] = SCANCODE_4; - gScan_code[17][0] = SCANCODE_6; - gScan_code[18][0] = SCANCODE_7; - gScan_code[16][0] = SCANCODE_5; - gScan_code[19][0] = SCANCODE_8; - gScan_code[21][0] = SCANCODE_A; - gScan_code[22][0] = SCANCODE_B; - gScan_code[20][0] = SCANCODE_9; - gScan_code[23][0] = SCANCODE_C; - gScan_code[25][0] = SCANCODE_E; - gScan_code[26][0] = SCANCODE_F; - gScan_code[24][0] = SCANCODE_D; - gScan_code[27][0] = SCANCODE_G; - gScan_code[29][0] = SCANCODE_I; - gScan_code[30][0] = SCANCODE_J; - gScan_code[28][0] = SCANCODE_H; - gScan_code[31][0] = SCANCODE_K; - gScan_code[33][0] = SCANCODE_M; - gScan_code[34][0] = SCANCODE_N; - gScan_code[32][0] = SCANCODE_L; - gScan_code[35][0] = SCANCODE_O; - gScan_code[37][0] = SCANCODE_Q; - gScan_code[38][0] = SCANCODE_R; - gScan_code[36][0] = SCANCODE_P; - gScan_code[39][0] = SCANCODE_S; - gScan_code[41][0] = SCANCODE_U; - gScan_code[42][0] = SCANCODE_V; - gScan_code[40][0] = SCANCODE_T; - gScan_code[43][0] = SCANCODE_W; - gScan_code[44][0] = SCANCODE_X; - gScan_code[45][0] = SCANCODE_Y; - gScan_code[46][0] = SCANCODE_Z; - gScan_code[47][0] = SCANCODE_GRAVE; - gScan_code[48][0] = SCANCODE_MINUS; - gScan_code[49][0] = SCANCODE_EQUALS; - gScan_code[50][0] = SCANCODE_BACK; - gScan_code[51][0] = SCANCODE_RETURN; - gScan_code[52][0] = SCANCODE_NUMPADENTER; - gScan_code[0][0] = SCANCODE_LSHIFT; - gScan_code[0][1] = SCANCODE_RSHIFT; - gScan_code[1][0] = SCANCODE_LMENU; - gScan_code[1][1] = SCANCODE_RMENU; - gScan_code[2][0] = SCANCODE_LCONTROL; - gScan_code[2][1] = SCANCODE_RCONTROL; - gScan_code[3][0] = SCANCODE_LCONTROL; - gScan_code[3][1] = SCANCODE_RCONTROL; - gScan_code[4][0] = SCANCODE_CAPITAL; - gScan_code[55][0] = SCANCODE_OEM_102; - gScan_code[54][0] = SCANCODE_SLASH; - gScan_code[56][0] = SCANCODE_SEMICOLON; - gScan_code[59][0] = SCANCODE_COMMA; - gScan_code[53][0] = SCANCODE_TAB; - gScan_code[58][0] = SCANCODE_PERIOD; - gScan_code[60][0] = SCANCODE_LBRACKET; - gScan_code[63][0] = SCANCODE_ESCAPE; - gScan_code[57][0] = SCANCODE_APOSTROPHE; - gScan_code[62][0] = SCANCODE_BACKSLASH; - gScan_code[64][0] = SCANCODE_INSERT; - gScan_code[67][0] = SCANCODE_END; - gScan_code[61][0] = SCANCODE_RBRACKET; - gScan_code[66][0] = SCANCODE_HOME; - gScan_code[68][0] = SCANCODE_PRIOR; - gScan_code[71][0] = SCANCODE_RIGHT; - gScan_code[65][0] = SCANCODE_DELETE; - gScan_code[70][0] = SCANCODE_LEFT; - gScan_code[72][0] = SCANCODE_UP; - gScan_code[69][0] = SCANCODE_NEXT; - gScan_code[74][0] = SCANCODE_NUMLOCK; - gScan_code[73][0] = SCANCODE_DOWN; - gScan_code[75][0] = SCANCODE_DIVIDE; - gScan_code[76][0] = SCANCODE_MULTIPLY; - gScan_code[78][0] = SCANCODE_ADD; - gScan_code[77][0] = SCANCODE_SUBTRACT; - gScan_code[80][0] = 0;''' - -# lines = stri.splitlines() -# for l in lines: -# parts = l.split(']') -# # print(parts) -# parts[0] = parts[0].strip() -# # i = parts[0].index(']') -# val_int = int(parts[0][11:]) -# # print(val_int) - -# printed = False -# for c in keycodes: -# if keycodes[c] == val_int: -# print('gScan_code[' + c + ']' + parts[1] + ']' + parts[2]) -# printed = True -# if not printed: -# print('error!') -# # break diff --git a/shadetable.tga b/shadetable.tga deleted file mode 100644 index 1b4888d6..00000000 Binary files a/shadetable.tga and /dev/null differ diff --git a/shadetablehack.c b/shadetablehack.c deleted file mode 100644 index af05246b..00000000 --- a/shadetablehack.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include -#include -#include - -#include "src/BRSRC13/include/brender/br_types.h" -#include -#include - -int main() { - - FILE* f = fopen("/opt/carma1sp/DATA/SHADETAB/STAAAAAA.TAB", "r+"); - - for (int row = 8; row < 16; row++) { - fseek(f, row * 256 + 52, SEEK_SET); - for (int col = 0; col < 256; col++) { - char c = (char)255; // (char)row + 16; - fwrite(&c, 1, 1, f); - } - } - fclose(f); -} diff --git a/src/DETHRACE/common/netgame.c b/src/DETHRACE/common/netgame.c index 40484e35..85e7f36c 100644 --- a/src/DETHRACE/common/netgame.c +++ b/src/DETHRACE/common/netgame.c @@ -1480,7 +1480,6 @@ void BuyPSPowerup(int pIndex) { } } else { NewTextHeadupSlot(eHeadupSlot_misc, 0, 3000, -4, GetMiscString(kMiscString_ONLY_AVAILABLE_IN_NET_GAMES)); - // NewTextHeadupSlot(eHeadupSlot_misc, 0, 3000, -4, GetMiscString(kMiscString_YOU_ARE_ALREADY_AT_MAX)); } } diff --git a/test.c b/test.c deleted file mode 100644 index ac91edd6..00000000 --- a/test.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include -#include -#include -#include - - -int main() { - - int *x = malloc(20); - *x = 1; - printf("x: %d\n", *x); - printf("freeing block...\n"); - free(x); - printf("x: %d\n", *x); - return 0; -} diff --git a/test.out b/test.out deleted file mode 100755 index 964e8feb..00000000 Binary files a/test.out and /dev/null differ diff --git a/tga.c b/tga.c deleted file mode 100644 index 27b49efb..00000000 --- a/tga.c +++ /dev/null @@ -1,200 +0,0 @@ -#include - -#define BYTE_RANGE 256; - -typedef struct { - char id_length; // length of id field (number of bytes - max 255) - char map_type; // colormap field (0 or 1; no map or 256 entry palette) - char image_type; // ( 0 - no image data included - // 1 - uncompressed, color mapped image - // 2 - uncompressed, RGB image - // 3 - uncompressed, black & white image - // 9 - run-length encoded(RLE-lossless compression),color mapped image - // 10 - RLE, RGB image - // 11 - compressed, black & white image ) - - int map_first; // first entry index for color map - int map_length; // total number of entries in color map - char map_entry_size; // number of bits per entry - - int x; // x cooridinate of origin - int y; // y cooridinate of origin - - int width; // width in pixels - int height; // height in pixels - - char bits_per_pixel; // number of bits per pixel - - char misc; // srsly? "scan origin and alpha bits" this example uses scan origin - // honestly, don't know what's going on here. we pass in a hex value - // :shrug_emoji: -} targa_header; - -int little_endianify(int number) { - return number % BYTE_RANGE; -} - -int big_endianify(int number) { - return number / BYTE_RANGE; -} - -////// write header function - -void write_header(targa_header header, FILE* tga) { - fputc(header.id_length, tga); - fputc(header.map_type, tga); - fputc(header.image_type, tga); - - fputc(little_endianify(header.map_first), tga); - fputc(big_endianify(header.map_first), tga); - - fputc(little_endianify(header.map_length), tga); - fputc(big_endianify(header.map_length), tga); - - fputc(header.map_entry_size, tga); - - fputc(little_endianify(header.x), tga); - fputc(big_endianify(header.x), tga); - fputc(little_endianify(header.y), tga); - fputc(big_endianify(header.y), tga); - - fputc(little_endianify(header.width), tga); - fputc(big_endianify(header.width), tga); - fputc(little_endianify(header.height), tga); - fputc(big_endianify(header.height), tga); - - fputc(header.bits_per_pixel, tga); - fputc(header.misc, tga); -} - -int dump_palette(void) { - FILE* tga; - targa_header header; - - int block_size = 10; - - header.id_length = 0; - header.map_type = 1; - header.image_type = 1; // uncompressed RGB image - - header.map_first = 0; - header.map_length = 256; - header.map_entry_size = 24; - - header.x = 0; - header.y = 0; - - int orig_width = 16; - int orig_height = 16; - header.width = orig_width * block_size + orig_width; - header.height = orig_height * block_size + orig_height + 1; - - header.bits_per_pixel = 8; - header.misc = 0x20; // scan from upper left corner - - tga = fopen("palette.tga", "wb"); - write_header(header, tga); - - FILE* palfile = fopen("/opt/carma1sp/DATA/REG/PALETTES/DRRENDER.PAL", "rb"); - char pal[256 * 4]; - fseek(palfile, 64, SEEK_SET); - fread(&pal, 4, 256, palfile); - - for (int i = 0; i < 256; i++) { - fputc(pal[i * 4 + 3], tga); - fputc(pal[i * 4 + 2], tga); - fputc(pal[i * 4 + 1], tga); - printf("%d: %c %c %c\n", i, pal[i * 4 + 1], pal[i * 4 + 2], pal[i * 4 + 3]); - } - - for (int black_line = 0; black_line < header.width; black_line++) { - fputc(0, tga); - } - - for (int row = 0; row < orig_height; row++) { - for (int block_line = 0; block_line < block_size; block_line++) { - for (int col = 0; col < orig_width; col++) { - for (int b = 0; b < block_size; b++) { - fputc(row * orig_width + col, tga); - } - fputc(0, tga); - } - } - for (int black_line = 0; black_line < header.width; black_line++) { - fputc(0, tga); - } - } - fclose(tga); - return 0; -} - -int dump_shadetable(void) { - FILE* tga; - targa_header header; - - int block_size = 10; - - header.id_length = 0; - header.map_type = 1; - header.image_type = 1; // uncompressed RGB image - - header.map_first = 0; - header.map_length = 256; - header.map_entry_size = 24; - - header.x = 0; - header.y = 0; - - int orig_width = 256; - int orig_height = 16; - header.width = orig_width * block_size + orig_width; - header.height = orig_height * block_size + orig_height + 1; - - header.bits_per_pixel = 8; - header.misc = 0x20; // scan from upper left corner - - tga = fopen("shadetable.tga", "wb"); - write_header(header, tga); - - FILE* palfile = fopen("/opt/carma1sp/DATA/REG/PALETTES/DRRENDER.PAL", "rb"); - char pal[256 * 4]; - fseek(palfile, 64, SEEK_SET); - fread(&pal, 4, 256, palfile); - - for (int i = 0; i < 256; i++) { - fputc(pal[i * 4 + 3], tga); - fputc(pal[i * 4 + 2], tga); - fputc(pal[i * 4 + 1], tga); - } - - FILE* stfile = fopen("/opt/carma1sp/DATA/SHADETAB/STAAAAAA.TAB", "rb"); - fseek(stfile, 52, SEEK_SET); - char st[256 * 16]; - fread(&st, 256 * 16, 1, stfile); - - for (int black_line = 0; black_line < header.width; black_line++) { - fputc(0, tga); - } - - for (int row = 0; row < orig_height; row++) { - for (int block_line = 0; block_line < block_size; block_line++) { - for (int col = 0; col < orig_width; col++) { - for (int b = 0; b < block_size; b++) { - fputc(st[row * orig_width + col], tga); - } - fputc(0, tga); - } - } - for (int black_line = 0; black_line < header.width; black_line++) { - fputc(0, tga); - } - } - fclose(tga); - return 0; -} - -int main() { - // dump_palette(); - dump_shadetable(); - return 0; -} diff --git a/tools/annotate.py b/tools/annotate.py deleted file mode 100755 index 6506af59..00000000 --- a/tools/annotate.py +++ /dev/null @@ -1,160 +0,0 @@ -import re -import sys - -SEGMENT_BASES = { - '0001': 0x401000, - '0002': 0x504000, - '0003': 0x507000, -} - -def parse_symbol_table(filename): - symbols = {} - in_symbol_table = False - with open(filename) as f: - for line in f: - # Detect start of symbol table - if 'Address' in line and 'Publics by Value' in line: - in_symbol_table = True - continue - if in_symbol_table: - # Match lines like: 0001:00000000 AdjustSkid - m = re.match(r'\s*([0-9A-Fa-f]{4}):([0-9A-Fa-f]{8})\s+(\w+)', line) - if m: - segment = m.group(1) - offset = int(m.group(2), 16) - name = m.group(3) - base = SEGMENT_BASES.get(segment, 0) - address = offset + base - symbols[name] = (f'0x{address:X}').lower() - return symbols - -if __name__ == '__main__': - if len(sys.argv) != 2: - print(f"Usage: {sys.argv[0]} ") - sys.exit(1) - filename = sys.argv[1] - for name, addr in parse_symbol_table(filename): - print(f'{name}: {addr}') - -def extract_function_name(line): - # Match function definitions at the start of a line (not indented), including those with function pointer arguments - m = re.match(r'^([a-zA-Z_][\w\s\*]*?)\s+([a-zA-Z_]\w*)\s*\((?:[^()]*|\([^()]*\))*\)\s*\{', line) - if m: - return m.group(2) - return None - -def extract_global_var_name(line): - # Match variable declarations at the start of a line (not indented) - # e.g., int foo = 5; or char* gDamage_names[] = { or tU32 gPanel_flic_data_length[2]; or br_matrix34 gSheer_mat = { or void (*gAdd_proc)(tNet_game_details*); - m = re.match(r'^[a-zA-Z_][\w\s\*]*\s+([a-zA-Z_]\w*)\s*(=.*)?;', line) - if m: - return m.group(1) - # Match array initializations like char* gDamage_names[] = { - m = re.match(r'^[a-zA-Z_][\w\s\*]*\s+([a-zA-Z_]\w*)\s*\[.*\]\s*=\s*\{', line) - if m: - return m.group(1) - # Match array declarations like tU32 gPanel_flic_data_length[2]; - m = re.match(r'^[a-zA-Z_][\w\s\*]*\s+([a-zA-Z_]\w*)\s*\[.*\]\s*;', line) - if m: - return m.group(1) - # Match struct/typedef/union initializations like br_matrix34 gSheer_mat = { - m = re.match(r'^[a-zA-Z_][\w\s\*]*\s+([a-zA-Z_]\w*)\s*=\s*\{', line) - if m: - return m.group(1) - # Match function pointer declarations like void (*gAdd_proc)(tNet_game_details*); - m = re.match(r'^[a-zA-Z_][\w\s\*]*\(\*([a-zA-Z_]\w*)\)\s*\([^)]*\)\s*;', line) - if m: - return m.group(1) - return None - -def extract_static_var_name(line): - m = re.match(r'^\s*static\s+(?:[\w\*\s]+\s+)(\w+)\s*(=.*)?;', line) - if m: - return m.group(1) - return None - - -def is_function_def(line): - return extract_function_name(line) is not None - -def is_global_var(line): - return ( - extract_global_var_name(line) is not None - and not is_function_def(line) - and not line.strip().startswith('//') - and not line.strip().startswith('/*') - and line.strip() != '' - ) - -def main(filename): - map_syms = parse_symbol_table("/Users/jeff/Downloads/carma/Carma_Win95.map") - with open(filename) as f: - lines = f.readlines() - - output = [] - brace_level = 0 - last_ignore_seen = 0 - current_function = '' - unmatched = [] - - for i, line in enumerate(lines): - if line == "}\n": - brace_level = 1 - - if line.strip() == '// UNUSED': - last_ignore_seen = i - - prev_line = output[-1] if output else '' - - # Only consider top-level (global) scope - if brace_level == 0: - func_name = extract_function_name(line) - var_name = extract_global_var_name(line) - - if func_name: - current_function = func_name - addr = map_syms.get(func_name) - annotation = f'// FUNCTION: CARM95 {addr}\n' - if not prev_line.strip().startswith('// FUNCTION: CARM95'): - if addr == None and last_ignore_seen != i - 1: - unmatched.append(func_name) - else: - output.append(annotation) - elif var_name: - addr = map_syms.get(var_name) - annotation = f'// GLOBAL: CARM95 {addr}\n' - if not prev_line.strip().startswith('// GLOBAL: CARM95'): - if addr == None and last_ignore_seen != i - 1: - unmatched.append(var_name) - else: - output.append(annotation) - else: - static_var_name = extract_static_var_name(line) - - if static_var_name: - qname = current_function + '_' + static_var_name - addr = map_syms.get(qname) - annotation = f' // GLOBAL: CARM95 {addr}\n' - if '// GLOBAL: CARM95' not in prev_line: - if addr == None and last_ignore_seen != i - 1: - unmatched.append(qname) - else: - output.append(annotation) - - output.append(line) - # Update brace level - brace_level += line.count('{') - line.count('}') - - - with open(filename, 'w') as f: - f.writelines(output) - - print("Unmatched in", filename) - print(unmatched) - -if __name__ == '__main__': - if len(sys.argv) != 2: - print("Usage: python annotate_c_globals.py ") - sys.exit(1) - - main(sys.argv[1])