diff --git a/src/Graphics_PS2.c b/src/Graphics_PS2.c index 7e6a8a023..cfcccb023 100644 --- a/src/Graphics_PS2.c +++ b/src/Graphics_PS2.c @@ -198,10 +198,6 @@ static int BINDS; void Gfx_BindTexture(GfxResourceID texId) { if (!texId) texId = white_square; CCTexture* tex = (CCTexture*)texId; - Platform_Log2("BIND: %i x %i", &tex->width, &tex->height); - // TODO - if (BINDS) return; - BINDS = 1; texbuffer_t texbuf; texbuf.width = max(256, tex->width); @@ -209,9 +205,8 @@ void Gfx_BindTexture(GfxResourceID texId) { // TODO terrible perf DMATAG_END(dma_tag, (q - current->data) - 1, 0, 0, 0); - dma_wait_fast(); dma_channel_send_chain(DMA_CHANNEL_GIF, current->data, q - current->data, 0, 0); - // + dma_wait_fast(); packet_t *packet = packet_init(200, PACKET_NORMAL); @@ -223,13 +218,11 @@ void Gfx_BindTexture(GfxResourceID texId) { dma_channel_send_chain(DMA_CHANNEL_GIF,packet->data, Q - packet->data, 0,0); dma_wait_fast(); - //packet_free(packet); + packet_free(packet); // TODO terrible perf q = dma_tag + 1; UpdateTextureBuffer(0, &texbuf, tex); - - Platform_LogConst("====="); } void Gfx_DeleteTexture(GfxResourceID* texId) { diff --git a/src/HeldBlockRenderer.c b/src/HeldBlockRenderer.c index 18b48a5bf..0d54bd281 100644 --- a/src/HeldBlockRenderer.c +++ b/src/HeldBlockRenderer.c @@ -32,7 +32,6 @@ static void SetHeldModel(struct Model* model) { } static void HeldBlockRenderer_RenderModel(void) { - static const cc_string block = String_FromConst("block"); struct Model* model; Gfx_SetFaceCulling(true); @@ -48,7 +47,7 @@ static void HeldBlockRenderer_RenderModel(void) { Model_RenderArm(model, &held_entity); Gfx_SetAlphaTest(false); } else { - model = Model_Get(&block); + model = Models.Block; SetHeldModel(model); Vec3_Set(held_entity.ModelScale, 0.4f,0.4f,0.4f); diff --git a/src/Model.c b/src/Model.c index 78ce23d87..967a82d58 100644 --- a/src/Model.c +++ b/src/Model.c @@ -2218,6 +2218,7 @@ static void BlockModel_Register(void) { block_model.pushes = false; block_model.maxVertices = BLOCKMODEL_MAX_VERTICES; Model_Register(&block_model); + Models.Block = &block_model; } diff --git a/src/Model.h b/src/Model.h index e9e042f72..7f074d471 100644 --- a/src/Model.h +++ b/src/Model.h @@ -112,8 +112,10 @@ CC_VAR extern struct _ModelsData { /* Maximum number of vertices that can be stored in Vertices. */ /* NOTE: If you change this, you MUST also destroy and recreate the dynamic VB. */ int MaxVertices; - /* Pointer to humanoid/human model.*/ + /* Pointer to humanoid/human model */ struct Model* Human; + /* Pointer to block model */ + struct Model* Block; } Models; /* Initialises fields of a model to default. */ diff --git a/src/Platform_PS2.c b/src/Platform_PS2.c index 675cf3eef..8adb545a3 100644 --- a/src/Platform_PS2.c +++ b/src/Platform_PS2.c @@ -30,6 +30,7 @@ #include #include #include +#include #define NEWLIB_PORT_AWARE #include #include @@ -37,8 +38,8 @@ #include "_PlatformConsole.h" const cc_result ReturnCode_FileShareViolation = 1000000000; // not used -const cc_result ReturnCode_FileNotFound = -ENOENT; -const cc_result ReturnCode_DirectoryExists = -EEXIST; +const cc_result ReturnCode_FileNotFound = -4; +const cc_result ReturnCode_DirectoryExists = -8; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; @@ -235,7 +236,7 @@ static int ExecThread(void* param) { ee_thread_status_t info; int res = ReferThreadStatus(thdID, &info); - if (res > 0 && info.stack) Mem_Free(info.stack); + if (res > 0 && info.stack) Mem_Free(info.stack); // TODO is it okay to free stack of running thread ???? return 0; // TODO detach ? } @@ -705,6 +706,9 @@ void Platform_Init(void) { // Create root directory int res = fioMkdir("mass:/ClassiCube"); Platform_Log1("ROOT CREATE %i", &res); + + dma_channel_initialize(DMA_CHANNEL_GIF, NULL, 0); + dma_channel_fast_waits(DMA_CHANNEL_GIF); } void Platform_Free(void) { }