diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-10-08 10:12:31 +0200 |
|---|---|---|
| committer | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-10-08 10:12:31 +0200 |
| commit | 3acc4f93f3b6a96da484aab1f08d61f900085e43 (patch) | |
| tree | 042ba2e5c35ba6b1e409c5c700177c7069e4c450 /libpsn00b/psxgpu | |
| parent | 6ee55c23b042a1559e8cabfccf3b9d3320c4c5cc (diff) | |
| download | psn00bsdk-3acc4f93f3b6a96da484aab1f08d61f900085e43.tar.gz | |
Fix DMACallback bug, disable logging in release builds
Diffstat (limited to 'libpsn00b/psxgpu')
| -rw-r--r-- | libpsn00b/psxgpu/common.c | 14 | ||||
| -rw-r--r-- | libpsn00b/psxgpu/image.c | 14 |
2 files changed, 21 insertions, 7 deletions
diff --git a/libpsn00b/psxgpu/common.c b/libpsn00b/psxgpu/common.c index cef1508..e06c63a 100644 --- a/libpsn00b/psxgpu/common.c +++ b/libpsn00b/psxgpu/common.c @@ -29,7 +29,13 @@ static volatile uint8_t _queue_head, _queue_tail, _queue_length; static volatile uint32_t _vblank_counter; static volatile uint16_t _last_hblank; -/* Interrupt handlers */ +/* Private utilities and interrupt handlers */ + +#ifdef DEBUG +#define _LOG(...) printf(__VA_ARGS__) +#else +#define _LOG(...) +#endif static void _vblank_handler(void) { _vblank_counter++; @@ -69,7 +75,7 @@ void ResetGraph(int mode) { _gpu_video_mode = (GPU_GP1 >> 20) & 1; ExitCriticalSection(); - printf("psxgpu: setup done, default mode is %s\n", _gpu_video_mode ? "PAL" : "NTSC"); + _LOG("psxgpu: setup done, default mode is %s\n", _gpu_video_mode ? "PAL" : "NTSC"); } if (mode == 3) { @@ -108,7 +114,7 @@ static void _default_vsync_halt(void) { return; } - printf("psxgpu: VSync() timeout\n"); + _LOG("psxgpu: VSync() timeout\n"); ChangeClearPAD(0); ChangeClearRCnt(3, 0); } @@ -230,7 +236,7 @@ void DrawOTag(const uint32_t *ot) { } IRQ_MASK = mask; - printf("psxgpu: DrawOTag() failed, draw queue full\n"); + _LOG("psxgpu: DrawOTag() failed, draw queue full\n"); return; } diff --git a/libpsn00b/psxgpu/image.c b/libpsn00b/psxgpu/image.c index da51e7d..6190c7a 100644 --- a/libpsn00b/psxgpu/image.c +++ b/libpsn00b/psxgpu/image.c @@ -10,7 +10,13 @@ #define DMA_CHUNK_LENGTH 8 -/* VRAM transfer API */ +/* Private utilities */ + +#ifdef DEBUG +#define _LOG(...) printf(__VA_ARGS__) +#else +#define _LOG(...) +#endif static void _load_store_image( uint32_t command, @@ -20,11 +26,11 @@ static void _load_store_image( ) { size_t length = rect->w * rect->h; if (length % 2) - printf("psxgpu: can't transfer an odd number of pixels\n"); + _LOG("psxgpu: can't transfer an odd number of pixels\n"); length /= 2; if ((length >= DMA_CHUNK_LENGTH) && (length % DMA_CHUNK_LENGTH)) { - printf("psxgpu: transfer data length (%d) is not a multiple of %d, rounding\n", length, DMA_CHUNK_LENGTH); + _LOG("psxgpu: transfer data length (%d) is not a multiple of %d, rounding\n", length, DMA_CHUNK_LENGTH); length += DMA_CHUNK_LENGTH - 1; } @@ -50,6 +56,8 @@ static void _load_store_image( DMA_CHCR(2) = 0x01000200 | ((mode & 1) ^ 1); } +/* VRAM transfer API */ + void LoadImage(const RECT *rect, const uint32_t *data) { _load_store_image(0xa0000000, 2, rect, (uint32_t *) data); } |
