Skip to content

Commit a23412c

Browse files
committed
DrawDist: update lods, move DrawBuffer to game.h
1 parent dbcc883 commit a23412c

File tree

3 files changed

+54
-37
lines changed

3 files changed

+54
-37
lines changed

OutRun2006Tweaks.lods.ini

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@
1111
# See-through mountains in distance from bunki
1212
0x1 = 0x1, 0xD, 0x22
1313

14-
# LAS VEGAS
15-
#[Stage 18]
16-
# Wall texture under tunnel (TODO: needs more testing, might need to set a dist limit on this map)
17-
# 0x1 = 0x1F
14+
# SNOW MOUNTAIN
15+
[Stage 4]
16+
# Piece of floating mountain geometry when entering the stage
17+
0x1 = 0x8
18+
# Random piece of floating geometry above the lift cables, didn't get a close look
19+
0x6 = 0x1E
20+
21+
# LAS VEGAS
22+
[Stage 18]
23+
# Building geo above winding section
24+
0x1 = 0x1F
25+
0x3 = 0x1, 0x3, 0x10, 0x11, 0x1F, 0x21, 0x4E, 0x50
1826

1927
# GRAND CANYON
2028
[Stage 20]
@@ -23,6 +31,10 @@
2331
0x1 = 0x2, 0x1A, 0x20, 0x22
2432
0x2 = 0x9
2533

34+
# MAYA
35+
[Stage 25]
36+
0x1 = 0x34
37+
2638
# NEW YORK
2739
[Stage 26]
2840
# Bushes when entering from bunki

src/game.hpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ typedef struct tagSPRARGS2
591591
} SPRARGS2;
592592
static_assert(sizeof(SPRARGS2) == 0xB8);
593593

594-
struct tagEvWorkRobot
594+
typedef struct tagEvWorkRobot
595595
{
596596
uint32_t workId_0;
597597
uint32_t dword4;
@@ -611,8 +611,25 @@ struct tagEvWorkRobot
611611
char byte85;
612612
uint8_t unk_86[2];
613613
uint8_t unk_88[8];
614-
};
615-
static_assert(sizeof(tagEvWorkRobot) == 0x90);
614+
} EvWorkRobot;
615+
static_assert(sizeof(EvWorkRobot) == 0x90);
616+
617+
typedef struct TDrawEntry
618+
{
619+
// todo
620+
} DrawEntry;
621+
622+
typedef struct TDrawBuffer
623+
{
624+
int NumBuffers_0;
625+
int MaxBuffers_4;
626+
int unk_8[1];
627+
int MaxBuffers_C;
628+
DrawEntry** BufferPtrs_10;
629+
DrawEntry* Buffer_14;
630+
void* UnkBuffer_18;
631+
} DrawBuffer;
632+
static_assert(sizeof(DrawBuffer) == 0x1C);
616633

617634
inline void WaitForDebugger()
618635
{

src/hooks_drawdistance.cpp

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -484,47 +484,35 @@ class DrawDistanceIncrease : public Hook
484484
};
485485
DrawDistanceIncrease DrawDistanceIncrease::instance;
486486

487-
// TODO: move this to game.h, should probably remove the resize function
488-
struct TDrawBuffer
489-
{
490-
int NumBuffers_0;
491-
int MaxBuffers_4;
492-
int unk_8[1];
493-
int MaxBuffers_C;
494-
struct TDrawEntry** BufferPtrs_10;
495-
struct TDrawEntry* Buffer_14;
496-
void* UnkBuffer_18;
497-
498-
void resize(int new_size)
499-
{
500-
int bufferPtrsSize_Imm = new_size * 4;
501-
int buffersSize_Imm = new_size * 0x3C;
502-
int unkbuffersSize_Imm = new_size * 0x40;
503-
504-
MaxBuffers_4 = new_size;
505-
MaxBuffers_C = new_size;
506-
507-
BufferPtrs_10 = (TDrawEntry**)malloc(bufferPtrsSize_Imm);
508-
Buffer_14 = (TDrawEntry*)malloc(buffersSize_Imm);
509-
UnkBuffer_18 = malloc(unkbuffersSize_Imm);
510-
}
511-
};
512-
513487
class DrawBufferExtension : public Hook
514488
{
515489
inline static SafetyHookInline drawbufferinit_hook = {};
516490
static void drawbufferinit_dest()
517491
{
518492
drawbufferinit_hook.call();
519493

520-
TDrawBuffer* s_ImmDrawBuffer = Module::exe_ptr<TDrawBuffer>(0x00464EF8);
521-
TDrawBuffer* s_AftDrawBuffer = Module::exe_ptr<TDrawBuffer>(0x004612D8);
494+
DrawBuffer* s_ImmDrawBuffer = Module::exe_ptr<DrawBuffer>(0x00464EF8);
495+
DrawBuffer* s_AftDrawBuffer = Module::exe_ptr<DrawBuffer>(0x004612D8);
522496

523497
constexpr int s_ImmDrawBufferSizeVanilla = 0x100;
524498
constexpr int s_AftDrawBufferSizeVanilla = 0x600;
525499

526-
s_ImmDrawBuffer->resize(s_ImmDrawBufferSizeVanilla * 0x10);
527-
s_AftDrawBuffer->resize(s_AftDrawBufferSizeVanilla * 2);
500+
auto resize_buffer = [](DrawBuffer* buffer, int max_size)
501+
{
502+
int bufferPtrsSize_Imm = max_size * 4;
503+
int buffersSize_Imm = max_size * 0x3C;
504+
int unkbuffersSize_Imm = max_size * 0x40;
505+
506+
buffer->MaxBuffers_4 = max_size;
507+
buffer->MaxBuffers_C = max_size;
508+
509+
buffer->BufferPtrs_10 = (DrawEntry**)malloc(bufferPtrsSize_Imm);
510+
buffer->Buffer_14 = (DrawEntry*)malloc(buffersSize_Imm);
511+
buffer->UnkBuffer_18 = malloc(unkbuffersSize_Imm);
512+
};
513+
514+
resize_buffer(s_ImmDrawBuffer, s_ImmDrawBufferSizeVanilla * 0x10);
515+
resize_buffer(s_AftDrawBuffer, s_AftDrawBufferSizeVanilla * 2);
528516
}
529517

530518
public:

0 commit comments

Comments
 (0)