mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 02:25:32 -04:00
PS1: Texturing sort of works technically
This commit is contained in:
parent
aa4fc4f218
commit
d78fb8ed21
@ -88,7 +88,7 @@ void Gfx_RestoreState(void) {
|
|||||||
|
|
||||||
// 2x2 dummy white texture
|
// 2x2 dummy white texture
|
||||||
struct Bitmap bmp;
|
struct Bitmap bmp;
|
||||||
BitmapCol pixels[4] = { BITMAPCOLOR_WHITE, BITMAPCOLOR_WHITE, BITMAPCOLOR_WHITE, BITMAPCOLOR_WHITE };
|
BitmapCol pixels[4] = { BitmapColor_RGB(255, 0, 0), BITMAPCOLOR_WHITE, BITMAPCOLOR_WHITE, BITMAPCOLOR_WHITE };
|
||||||
Bitmap_Init(bmp, 2, 2, pixels);
|
Bitmap_Init(bmp, 2, 2, pixels);
|
||||||
white_square = Gfx_CreateTexture(&bmp, 0, false);
|
white_square = Gfx_CreateTexture(&bmp, 0, false);
|
||||||
}
|
}
|
||||||
@ -211,18 +211,21 @@ static void* AllocTextureAt(int i, struct Bitmap* bmp) {
|
|||||||
|
|
||||||
int page = TPAGE_START_HOR + (line / TPAGE_HEIGHT);
|
int page = TPAGE_START_HOR + (line / TPAGE_HEIGHT);
|
||||||
// In bottom half of VRAM? Need to offset horizontally again
|
// In bottom half of VRAM? Need to offset horizontally again
|
||||||
if (page >= TPAGES_PER_HALF) page += TPAGE_START_HOR;
|
if (page >= TPAGES_PER_HALF) page += TPAGE_START_HOR;
|
||||||
|
|
||||||
|
int pageX = page % TPAGES_PER_HALF;
|
||||||
|
int pageY = page / TPAGES_PER_HALF;
|
||||||
|
|
||||||
for (int i = tex->line; i < tex->line + tex->height; i++)
|
for (int i = tex->line; i < tex->line + tex->height; i++)
|
||||||
{
|
{
|
||||||
VRAM_SetUsed(i);
|
VRAM_SetUsed(i);
|
||||||
}
|
}
|
||||||
tex->tpage = page;
|
tex->tpage = (2 << 7) | (pageY << 4) | pageX;
|
||||||
Platform_Log4("%i x %i = %i,%i", &bmp->width, &bmp->height, &line, &page);
|
Platform_Log4("%i x %i = %i,%i", &bmp->width, &bmp->height, &line, &page);
|
||||||
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
rect.x = ((page % TPAGES_PER_HALF)) * TPAGE_WIDTH;
|
rect.x = pageX * TPAGE_WIDTH;
|
||||||
rect.y = ((page / TPAGES_PER_HALF)) * TPAGE_HEIGHT + (line % TPAGE_HEIGHT);
|
rect.y = pageY * TPAGE_HEIGHT + (line % TPAGE_HEIGHT);
|
||||||
rect.w = bmp->width;
|
rect.w = bmp->width;
|
||||||
rect.h = bmp->height;
|
rect.h = bmp->height;
|
||||||
|
|
||||||
|
@ -18,6 +18,13 @@
|
|||||||
#include <psxgpu.h>
|
#include <psxgpu.h>
|
||||||
#include <hwregs_c.h>
|
#include <hwregs_c.h>
|
||||||
void exit(int code) { _boot(); }
|
void exit(int code) { _boot(); }
|
||||||
|
|
||||||
|
// The SDK calloc doesn't zero memory, so need to override it
|
||||||
|
void* calloc(size_t num, size_t size) {
|
||||||
|
void* ptr = malloc(num * size);
|
||||||
|
if (ptr) memset(ptr, 0, num * size);
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
#include "_PlatformConsole.h"
|
#include "_PlatformConsole.h"
|
||||||
|
|
||||||
const cc_result ReturnCode_FileShareViolation = 1000000000; // not used
|
const cc_result ReturnCode_FileShareViolation = 1000000000; // not used
|
||||||
|
Loading…
x
Reference in New Issue
Block a user