mirror of
https://github.com/XProger/OpenLara.git
synced 2025-01-17 12:58:50 +01:00
#368 GBA clearFB_asm + sndClear_asm instead of DMA fill, increase fog distance (2 blocks)
This commit is contained in:
parent
f1c1d835fc
commit
40eb268b3a
@ -29,10 +29,6 @@ EWRAM_DATA const char* const* STR = STR_EN;
|
||||
|
||||
EWRAM_DATA ExtraInfoLara playersExtra[MAX_PLAYERS];
|
||||
|
||||
#if defined(USE_VRAM_MESH) || defined(USE_VRAM_ROOM)
|
||||
uint8* vramPtr = (uint8*)0x06014000;
|
||||
#endif
|
||||
|
||||
#if defined(__GBA__)
|
||||
#include "TRACKS_IMA.h"
|
||||
#include "TITLE_SCR.h"
|
||||
|
@ -462,7 +462,7 @@ extern uint8* vramPtr;
|
||||
#define FOV_SHIFT 3
|
||||
#define FOG_SHIFT 1
|
||||
#define FOG_MAX VIEW_DIST
|
||||
#define FOG_MIN (FOG_MAX - 4096)
|
||||
#define FOG_MIN (FOG_MAX - 2048)
|
||||
#define VIEW_MIN_F (64 << FIXED_SHIFT)
|
||||
#define VIEW_MAX_F (VIEW_DIST << FIXED_SHIFT)
|
||||
|
||||
|
@ -189,6 +189,7 @@ void readLevel(const uint8* data)
|
||||
|
||||
#ifdef USE_VRAM_MESH // experimental, should be per level or dynamic
|
||||
vramMeshesCount = 0;
|
||||
vramPtr = (uint8*)0x06014000;
|
||||
vramPtr = pushToVRAM(vramPtr, models + ITEM_LARA);
|
||||
vramPtr = pushToVRAM(vramPtr, models + ITEM_LARA_PISTOLS);
|
||||
vramPtr = pushToVRAM(vramPtr, models + ITEM_LARA_SHOTGUN);
|
||||
|
43
src/platform/gba/asm/clearFB.s
Normal file
43
src/platform/gba/asm/clearFB.s
Normal file
@ -0,0 +1,43 @@
|
||||
#include "common_asm.inc"
|
||||
|
||||
dst .req r0 // arg
|
||||
end .req r14
|
||||
|
||||
.global clearFB_asm
|
||||
clearFB_asm:
|
||||
stmfd sp!, {r4-r6}
|
||||
fiq_on
|
||||
|
||||
// 12 words
|
||||
mov r1, #0
|
||||
mov r2, #0
|
||||
mov r3, #0
|
||||
mov r4, #0
|
||||
mov r5, #0
|
||||
mov r6, #0
|
||||
// FIQ regs
|
||||
mov r8, #0
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
mov r11, #0
|
||||
mov r12, #0
|
||||
mov r13, #0
|
||||
add end, dst, #(FRAME_WIDTH * FRAME_HEIGHT)
|
||||
|
||||
.loop:
|
||||
// fill 12 * 4 * 8 bytes per iteration
|
||||
stmia dst!, {r1-r6, r8-r13}
|
||||
stmia dst!, {r1-r6, r8-r13}
|
||||
stmia dst!, {r1-r6, r8-r13}
|
||||
stmia dst!, {r1-r6, r8-r13}
|
||||
stmia dst!, {r1-r6, r8-r13}
|
||||
stmia dst!, {r1-r6, r8-r13}
|
||||
stmia dst!, {r1-r6, r8-r13}
|
||||
stmia dst!, {r1-r6, r8-r13}
|
||||
|
||||
cmp dst, end
|
||||
blt .loop
|
||||
|
||||
fiq_off
|
||||
ldmfd sp!, {r4-r6}
|
||||
bx lr
|
@ -77,7 +77,7 @@
|
||||
.equ VIEW_MAX, (10 << 10)
|
||||
.equ VIEW_OFF, 4096
|
||||
.equ FOG_SHIFT, 4
|
||||
.equ FOG_MIN, (VIEW_MAX - 4096)
|
||||
.equ FOG_MIN, (VIEW_MAX - 2048)
|
||||
|
||||
.equ OT_SHIFT, 4
|
||||
.equ OT_SIZE, ((VIEW_MAX >> OT_SHIFT) + 1)
|
||||
|
@ -90,4 +90,27 @@ sndPCM_mix_asm:
|
||||
blt .loop_mix
|
||||
|
||||
ldmfd sp!, {r4-r6}
|
||||
bx lr
|
||||
|
||||
.global sndClear_asm
|
||||
sndClear_asm:
|
||||
// 4 words
|
||||
mov r1, #0
|
||||
mov r2, #0
|
||||
mov r3, #0
|
||||
mov r12, #0
|
||||
|
||||
// fill 11 * 4 * 4 = 176 bytes
|
||||
stmia r0!, {r1-r3, r12}
|
||||
stmia r0!, {r1-r3, r12}
|
||||
stmia r0!, {r1-r3, r12}
|
||||
stmia r0!, {r1-r3, r12}
|
||||
stmia r0!, {r1-r3, r12}
|
||||
stmia r0!, {r1-r3, r12}
|
||||
stmia r0!, {r1-r3, r12}
|
||||
stmia r0!, {r1-r3, r12}
|
||||
stmia r0!, {r1-r3, r12}
|
||||
stmia r0!, {r1-r3, r12}
|
||||
stmia r0!, {r1-r3, r12}
|
||||
|
||||
bx lr
|
@ -70,6 +70,10 @@ Face* gOT[OT_SIZE]; // IWRAM 2.5k
|
||||
Vertex* gVerticesBase = gVertices;
|
||||
Face* gFacesBase = gFaces;
|
||||
|
||||
#if defined(USE_VRAM_MESH) || defined(USE_VRAM_ROOM)
|
||||
uint8* vramPtr;
|
||||
#endif
|
||||
|
||||
enum ClipFlags {
|
||||
CLIP_LEFT = 1 << 0,
|
||||
CLIP_RIGHT = 1 << 1,
|
||||
@ -129,6 +133,7 @@ extern "C" {
|
||||
#define faceAddMeshQuads faceAddMeshQuads_asm
|
||||
#define faceAddMeshTriangles faceAddMeshTriangles_asm
|
||||
#define rasterize rasterize_asm
|
||||
#define clearFB clearFB_asm
|
||||
|
||||
extern "C" {
|
||||
void transformRoom_asm(const RoomVertex* vertices, int32 count);
|
||||
@ -139,6 +144,7 @@ extern "C" {
|
||||
void faceAddMeshQuads_asm(const MeshQuad* polys, int32 count);
|
||||
void faceAddMeshTriangles_asm(const MeshTriangle* polys, int32 count);
|
||||
void rasterize_asm(uint32 flags, VertexLink* top);
|
||||
void clearFB_asm(void* fb);
|
||||
}
|
||||
#else
|
||||
#define transformRoom transformRoom_c
|
||||
@ -149,6 +155,7 @@ extern "C" {
|
||||
#define faceAddMeshQuads faceAddMeshQuads_c
|
||||
#define faceAddMeshTriangles faceAddMeshTriangles_c
|
||||
#define rasterize rasterize_c
|
||||
#define clearFB(fb) dmaFill(fb, 0, FRAME_WIDTH * FRAME_HEIGHT)
|
||||
|
||||
X_INLINE bool checkBackface(const Vertex* a, const Vertex* b, const Vertex* c)
|
||||
{
|
||||
@ -805,7 +812,7 @@ void faceAddMesh(const MeshQuad* quads, const MeshTriangle* triangles, int32 qCo
|
||||
|
||||
void clear()
|
||||
{
|
||||
dmaFill((void*)fb, 0, FRAME_WIDTH * FRAME_HEIGHT);
|
||||
clearFB((void*)fb);
|
||||
}
|
||||
|
||||
void renderRoom(Room* room)
|
||||
|
@ -27,8 +27,10 @@ int8 soundBuffer[2 * SND_SAMPLES + 32]; // 32 bytes of silence for DMA overrun w
|
||||
#define sndIMA_fill sndIMA_fill_asm
|
||||
#define sndPCM_fill sndPCM_fill_asm
|
||||
#define sndPCM_mix sndPCM_mix_asm
|
||||
#define sndClear sndClear_asm
|
||||
|
||||
extern "C" {
|
||||
void sndClear_asm(int8* buffer);
|
||||
void sndIMA_fill_asm(IMA_STATE &state, int8* buffer, const uint8* data, int32 size);
|
||||
int32 sndPCM_fill_asm(int32 pos, int32 inc, int32 size, int32 volume, const uint8* data, int8* buffer);
|
||||
int32 sndPCM_mix_asm(int32 pos, int32 inc, int32 size, int32 volume, const uint8* data, int8* buffer);
|
||||
@ -37,6 +39,7 @@ int8 soundBuffer[2 * SND_SAMPLES + 32]; // 32 bytes of silence for DMA overrun w
|
||||
#define sndIMA_fill sndIMA_c
|
||||
#define sndPCM_fill sndPCM_c
|
||||
#define sndPCM_mix sndPCM_c
|
||||
#define sndClear(b) dmaFill(b, SND_ENCODE(0), SND_SAMPLES * sizeof(b[0]))
|
||||
|
||||
#define DECODE_IMA_4(n)\
|
||||
step = IMA_STEP[idx];\
|
||||
@ -286,7 +289,7 @@ void sndFill(int8* buffer)
|
||||
if (mix) {
|
||||
music.fill(buffer);
|
||||
} else {
|
||||
dmaFill(buffer, SND_ENCODE(0), SND_SAMPLES * sizeof(buffer[0]));
|
||||
sndClear(buffer);
|
||||
}
|
||||
|
||||
int32 ch = channelsCount;
|
||||
|
Loading…
x
Reference in New Issue
Block a user