mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
PS2: Improve stability a bit
This commit is contained in:
parent
e20bf233aa
commit
e591bab6e6
@ -198,10 +198,6 @@ static int BINDS;
|
|||||||
void Gfx_BindTexture(GfxResourceID texId) {
|
void Gfx_BindTexture(GfxResourceID texId) {
|
||||||
if (!texId) texId = white_square;
|
if (!texId) texId = white_square;
|
||||||
CCTexture* tex = (CCTexture*)texId;
|
CCTexture* tex = (CCTexture*)texId;
|
||||||
Platform_Log2("BIND: %i x %i", &tex->width, &tex->height);
|
|
||||||
// TODO
|
|
||||||
if (BINDS) return;
|
|
||||||
BINDS = 1;
|
|
||||||
|
|
||||||
texbuffer_t texbuf;
|
texbuffer_t texbuf;
|
||||||
texbuf.width = max(256, tex->width);
|
texbuf.width = max(256, tex->width);
|
||||||
@ -209,9 +205,8 @@ void Gfx_BindTexture(GfxResourceID texId) {
|
|||||||
|
|
||||||
// TODO terrible perf
|
// TODO terrible perf
|
||||||
DMATAG_END(dma_tag, (q - current->data) - 1, 0, 0, 0);
|
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_channel_send_chain(DMA_CHANNEL_GIF, current->data, q - current->data, 0, 0);
|
||||||
//
|
dma_wait_fast();
|
||||||
|
|
||||||
packet_t *packet = packet_init(200, PACKET_NORMAL);
|
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_channel_send_chain(DMA_CHANNEL_GIF,packet->data, Q - packet->data, 0,0);
|
||||||
dma_wait_fast();
|
dma_wait_fast();
|
||||||
|
|
||||||
//packet_free(packet);
|
packet_free(packet);
|
||||||
|
|
||||||
// TODO terrible perf
|
// TODO terrible perf
|
||||||
q = dma_tag + 1;
|
q = dma_tag + 1;
|
||||||
UpdateTextureBuffer(0, &texbuf, tex);
|
UpdateTextureBuffer(0, &texbuf, tex);
|
||||||
|
|
||||||
Platform_LogConst("=====");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_DeleteTexture(GfxResourceID* texId) {
|
void Gfx_DeleteTexture(GfxResourceID* texId) {
|
||||||
|
@ -32,7 +32,6 @@ static void SetHeldModel(struct Model* model) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void HeldBlockRenderer_RenderModel(void) {
|
static void HeldBlockRenderer_RenderModel(void) {
|
||||||
static const cc_string block = String_FromConst("block");
|
|
||||||
struct Model* model;
|
struct Model* model;
|
||||||
|
|
||||||
Gfx_SetFaceCulling(true);
|
Gfx_SetFaceCulling(true);
|
||||||
@ -48,7 +47,7 @@ static void HeldBlockRenderer_RenderModel(void) {
|
|||||||
Model_RenderArm(model, &held_entity);
|
Model_RenderArm(model, &held_entity);
|
||||||
Gfx_SetAlphaTest(false);
|
Gfx_SetAlphaTest(false);
|
||||||
} else {
|
} else {
|
||||||
model = Model_Get(&block);
|
model = Models.Block;
|
||||||
SetHeldModel(model);
|
SetHeldModel(model);
|
||||||
Vec3_Set(held_entity.ModelScale, 0.4f,0.4f,0.4f);
|
Vec3_Set(held_entity.ModelScale, 0.4f,0.4f,0.4f);
|
||||||
|
|
||||||
|
@ -2218,6 +2218,7 @@ static void BlockModel_Register(void) {
|
|||||||
block_model.pushes = false;
|
block_model.pushes = false;
|
||||||
block_model.maxVertices = BLOCKMODEL_MAX_VERTICES;
|
block_model.maxVertices = BLOCKMODEL_MAX_VERTICES;
|
||||||
Model_Register(&block_model);
|
Model_Register(&block_model);
|
||||||
|
Models.Block = &block_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,8 +112,10 @@ CC_VAR extern struct _ModelsData {
|
|||||||
/* Maximum number of vertices that can be stored in Vertices. */
|
/* Maximum number of vertices that can be stored in Vertices. */
|
||||||
/* NOTE: If you change this, you MUST also destroy and recreate the dynamic VB. */
|
/* NOTE: If you change this, you MUST also destroy and recreate the dynamic VB. */
|
||||||
int MaxVertices;
|
int MaxVertices;
|
||||||
/* Pointer to humanoid/human model.*/
|
/* Pointer to humanoid/human model */
|
||||||
struct Model* Human;
|
struct Model* Human;
|
||||||
|
/* Pointer to block model */
|
||||||
|
struct Model* Block;
|
||||||
} Models;
|
} Models;
|
||||||
|
|
||||||
/* Initialises fields of a model to default. */
|
/* Initialises fields of a model to default. */
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <sbv_patches.h>
|
#include <sbv_patches.h>
|
||||||
#include <netman.h>
|
#include <netman.h>
|
||||||
#include <ps2ip.h>
|
#include <ps2ip.h>
|
||||||
|
#include <dma.h>
|
||||||
#define NEWLIB_PORT_AWARE
|
#define NEWLIB_PORT_AWARE
|
||||||
#include <fileio.h>
|
#include <fileio.h>
|
||||||
#include <io_common.h>
|
#include <io_common.h>
|
||||||
@ -37,8 +38,8 @@
|
|||||||
#include "_PlatformConsole.h"
|
#include "_PlatformConsole.h"
|
||||||
|
|
||||||
const cc_result ReturnCode_FileShareViolation = 1000000000; // not used
|
const cc_result ReturnCode_FileShareViolation = 1000000000; // not used
|
||||||
const cc_result ReturnCode_FileNotFound = -ENOENT;
|
const cc_result ReturnCode_FileNotFound = -4;
|
||||||
const cc_result ReturnCode_DirectoryExists = -EEXIST;
|
const cc_result ReturnCode_DirectoryExists = -8;
|
||||||
|
|
||||||
const cc_result ReturnCode_SocketInProgess = EINPROGRESS;
|
const cc_result ReturnCode_SocketInProgess = EINPROGRESS;
|
||||||
const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK;
|
const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK;
|
||||||
@ -235,7 +236,7 @@ static int ExecThread(void* param) {
|
|||||||
ee_thread_status_t info;
|
ee_thread_status_t info;
|
||||||
|
|
||||||
int res = ReferThreadStatus(thdID, &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 ?
|
return 0; // TODO detach ?
|
||||||
}
|
}
|
||||||
@ -705,6 +706,9 @@ void Platform_Init(void) {
|
|||||||
// Create root directory
|
// Create root directory
|
||||||
int res = fioMkdir("mass:/ClassiCube");
|
int res = fioMkdir("mass:/ClassiCube");
|
||||||
Platform_Log1("ROOT CREATE %i", &res);
|
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) { }
|
void Platform_Free(void) { }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user