mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 18:15:28 -04:00
Saturn: Double performance and fix timing sort of
This commit is contained in:
parent
1e765919ea
commit
a9929e52b0
3
.github/workflows/build_saturn.yml
vendored
3
.github/workflows/build_saturn.yml
vendored
@ -21,7 +21,8 @@ jobs:
|
||||
- name: Compile Saturn build
|
||||
id: compile
|
||||
run: |
|
||||
pacman -S curl
|
||||
apt-get update
|
||||
apt-get -y install curl
|
||||
make saturn
|
||||
|
||||
- uses: ./.github/actions/notify_failure
|
||||
|
@ -330,8 +330,8 @@ static void Transform(Vec3* result, struct VertexTextured* a, const struct Matri
|
||||
float z = a->x * mat->row1.z + a->y * mat->row2.z + a->z * mat->row3.z + mat->row4.z;
|
||||
float w = a->x * mat->row1.w + a->y * mat->row2.w + a->z * mat->row3.w + mat->row4.w;
|
||||
|
||||
result->x = (x/w) * (320/2);
|
||||
result->y = (y/w) * -(224/2);
|
||||
result->x = (x/w) * (SCREEN_WIDTH / 2);
|
||||
result->y = (y/w) * -(SCREEN_HEIGHT / 2);
|
||||
result->z = (z/w) * 1024;
|
||||
}
|
||||
|
||||
@ -343,10 +343,10 @@ static void DrawTexturedQuads2D(int verticesCount, int startVertex) {
|
||||
struct VertexTextured* v = (struct VertexTextured*)gfx_vertices + startVertex + i;
|
||||
|
||||
int16_vec2_t points[4];
|
||||
points[0].x = v[0].x; points[0].y = v[0].y;
|
||||
points[1].x = v[1].x; points[1].y = v[1].y;
|
||||
points[2].x = v[2].x; points[2].y = v[2].y;
|
||||
points[3].x = v[3].x; points[3].y = v[3].y;
|
||||
points[0].x = (int)v[0].x - SCREEN_WIDTH / 2; points[0].y = (int)v[0].y - SCREEN_HEIGHT / 2;
|
||||
points[1].x = (int)v[1].x - SCREEN_WIDTH / 2; points[1].y = (int)v[1].y - SCREEN_HEIGHT / 2;
|
||||
points[2].x = (int)v[2].x - SCREEN_WIDTH / 2; points[2].y = (int)v[2].y - SCREEN_HEIGHT / 2;
|
||||
points[3].x = (int)v[3].x - SCREEN_WIDTH / 2; points[3].y = (int)v[3].y - SCREEN_HEIGHT / 2;
|
||||
|
||||
int R = PackedCol_R(v->Col);
|
||||
int G = PackedCol_G(v->Col);
|
||||
@ -399,13 +399,17 @@ static void DrawTexturedQuads3D(int verticesCount, int startVertex) {
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||
if (gfx_rendering2D && gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||
DrawTexturedQuads2D(verticesCount, startVertex);
|
||||
} else if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||
DrawTexturedQuads3D(verticesCount, startVertex);
|
||||
}
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris(int verticesCount) {
|
||||
if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||
if (gfx_rendering2D && gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||
DrawTexturedQuads2D(verticesCount, 0);
|
||||
} else if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||
DrawTexturedQuads3D(verticesCount, 0);
|
||||
}
|
||||
}
|
||||
|
@ -64,13 +64,17 @@ cc_uint64 Stopwatch_Measure(void) {
|
||||
|
||||
cc_uint64 Stopwatch_ElapsedMicroseconds(cc_uint64 beg, cc_uint64 end) {
|
||||
if (end < beg) return 0;
|
||||
return (end - beg); // TODO measure time
|
||||
cc_uint32 delta = end - beg;
|
||||
|
||||
// TODO still wrong?? and overflows?? and PAL detection ???
|
||||
return (delta * 1000) / CPU_FRT_NTSC_320_128_COUNT_1MS;
|
||||
}
|
||||
|
||||
static void ovf_handler(void) { overflow_count++; }
|
||||
|
||||
static void Stopwatch_Init(void) {
|
||||
cpu_frt_init(CPU_FRT_CLOCK_DIV_8);
|
||||
//cpu_frt_init(CPU_FRT_CLOCK_DIV_8);
|
||||
cpu_frt_init(CPU_FRT_CLOCK_DIV_128);
|
||||
cpu_frt_ovi_set(ovf_handler);
|
||||
|
||||
cpu_frt_interrupt_priority_set(15);
|
||||
|
@ -252,7 +252,8 @@ static int MapNativeKey(int k, int l) {
|
||||
case DOM_VK_VOLUME_DOWN: return CCKEY_VOLUME_DOWN;
|
||||
case DOM_VK_VOLUME_UP: return CCKEY_VOLUME_UP;
|
||||
|
||||
case 173: return CCKEY_VOLUME_MUTE;
|
||||
/* Chrome specific keys */
|
||||
/*case 173: return CCKEY_VOLUME_MUTE; same as DOM_VK_HYPHEN_MINUS */
|
||||
case 174: return CCKEY_VOLUME_DOWN;
|
||||
case 175: return CCKEY_VOLUME_UP;
|
||||
case 176: return CCKEY_MEDIA_NEXT;
|
||||
|
@ -52,7 +52,7 @@ static int win_totalWidth, win_totalHeight; /* Size of window including titlebar
|
||||
static cc_bool is_ansiWindow, grabCursor;
|
||||
static int windowX, windowY;
|
||||
|
||||
static const cc_uint8 key_map[14 * 16] = {
|
||||
static const cc_uint8 key_map[] = {
|
||||
/* 00 */ 0, 0, 0, 0, 0, 0, 0, 0, CCKEY_BACKSPACE, CCKEY_TAB, 0, 0, CCKEY_F5, CCKEY_ENTER, 0, 0,
|
||||
/* 10 */ 0, 0, 0, CCKEY_PAUSE, CCKEY_CAPSLOCK, 0, 0, 0, 0, 0, 0, CCKEY_ESCAPE, 0, 0, 0, 0,
|
||||
/* 20 */ CCKEY_SPACE, CCKEY_PAGEUP, CCKEY_PAGEDOWN, CCKEY_END, CCKEY_HOME, CCKEY_LEFT, CCKEY_UP, CCKEY_RIGHT, CCKEY_DOWN, 0, CCKEY_PRINTSCREEN, 0, CCKEY_PRINTSCREEN, CCKEY_INSERT, CCKEY_DELETE, 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user