Amiga: Separate makefile

This commit is contained in:
UnknownShadow200 2024-10-20 16:20:51 +11:00
parent f8319ad828
commit c1eea9b09f
6 changed files with 111 additions and 43 deletions

13
.gitignore vendored
View file

@ -26,20 +26,24 @@ xcuserdata/
# Nintendo Console build results
build-3ds/
build-gc/
build-nds/
build-dsi/
build-n64/
build-gc/
build-wii/
build-wiiu/
build-switch/
classicube.nds
# SEGA console build results
build-32x/
build-saturn/
build-dc/
IP.BIN
ISO_FILES/
third_party/gldc/libGLdc.a
build-saturn/
cd/
# Microsoft console build results
build-360/
main.exe
@ -48,6 +52,7 @@ misc/xbox/ps_coloured.inl
misc/xbox/ps_textured.inl
misc/xbox/vs_coloured.inl
misc/xbox/vs_textured.inl
# Sony console build results
build-ps2/
build-ps3/
@ -58,10 +63,12 @@ PARAM.SFO
param.sfo
eboot.bin
# Desktop build results
build-amiga-68k/
# Build results
[Dd]ebug/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/

View file

@ -146,12 +146,6 @@ ifeq ($(PLAT),dos)
BUILD_DIR = build-dos
endif
ifeq ($(PLAT),amiga_68k)
CC = m68k-amiga-elf-gcc
CFLAGS += -DPLAT_AMIGA
BUILD_DIR = build-amiga_68k
endif
ifdef SDL2
CFLAGS += -DCC_WIN_BACKEND=CC_WIN_BACKEND_SDL2
@ -214,8 +208,6 @@ irix:
$(MAKE) $(TARGET) PLAT=irix
dos:
$(MAKE) $(TARGET) PLAT=dos
amiga_68k:
$(MAKE) $(TARGET) PLAT=amiga_68k
# Default overrides
sdl2:
$(MAKE) $(TARGET) SDL2=1
@ -267,6 +259,10 @@ macclassic_68k:
$(MAKE) -f misc/macclassic/Makefile_68k
macclassic_ppc:
$(MAKE) -f misc/macclassic/Makefile_ppc
amiga_68k:
$(MAKE) -f misc/amiga/Makefile_68k
amiga_ppc:
$(MAKE) -f misc/amiga/Makefile_ppc
clean:
$(RM) $(OBJECTS)

44
misc/amiga/Makefile_68k Normal file
View file

@ -0,0 +1,44 @@
AS=m68k-amiga-elf-as
CC=m68k-amiga-elf-gcc
CXX=m68k-amiga-elf-g++
CFLAGS :=-O1 -fno-math-errno -DPLAT_AMIGA
TARGET := ClassiCube-68k
BUILD_DIR := build-amiga-68k
SOURCE_DIR := src
LDFLAGS := -nostdlib
C_SOURCES := $(wildcard $(SOURCE_DIR)/*.c)
C_ASSEMS := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.S, $(C_SOURCES))
C_OBJECTS := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
# Dependency tracking
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
DEPFILES := $(C_OBJECTS:%.o=%.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
default: $(BUILD_DIR) $(TARGET).elf
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(TARGET).elf: $(C_OBJECTS)
$(CC) $(LDFLAGS) -o $(TARGET).elf $(C_OBJECTS)
#---------------------------------------------------------------------------------
# object generation
#---------------------------------------------------------------------------------
$(C_OBJECTS): $(BUILD_DIR)/%.o : $(BUILD_DIR)/%.S
$(AS) $< -o $@
$(C_ASSEMS): $(BUILD_DIR)/%.S : $(SOURCE_DIR)/%.c
$(CC) $(CFLAGS) $(DEPFLAGS) -S -c $< -o $@
# Dependency tracking
$(DEPFILES):
include $(wildcard $(DEPFILES))

View file

@ -108,8 +108,7 @@ void Gfx_Create(void) {
InitGeom();
gte_SetGeomOffset(Window_Main.Width / 2, Window_Main.Height / 2);
// Set screen depth (basically FOV control, W/2 works best)
gte_SetGeomScreen(Window_Main.Width / 2);
gte_SetGeomScreen(Window_Main.Height / 2);
}
void Gfx_Free(void) {
@ -524,12 +523,6 @@ static struct MatrixRow mvp_row1, mvp_row2, mvp_row3, mvp_trans;
static void LoadTransformMatrix(struct Matrix* src) {
// https://math.stackexchange.com/questions/237369/given-this-transformation-matrix-how-do-i-decompose-it-into-translation-rotati
MATRIX mtx;
mtx.t[0] = (int)(src->row4.x);
mtx.t[1] = (int)(src->row4.y);
mtx.t[2] = (int)(src->row4.z);
mvp_trans.x = XYZFixed(1) * ToFixed(src->row4.x);
mvp_trans.y = XYZFixed(1) * ToFixed(src->row4.y);
mvp_trans.z = XYZFixed(1) * ToFixed(src->row4.z);
@ -550,23 +543,30 @@ static void LoadTransformMatrix(struct Matrix* src) {
mvp_row3.z = ToFixed(src->row3.z);
mvp_row3.w = ToFixed(src->row3.w);
//Platform_Log3("X: %f3, Y: %f3, Z: %f3", &src->row1.x, &src->row1.y, &src->row1.z);
//Platform_Log3("X: %f3, Y: %f3, Z: %f3", &src->row2.x, &src->row2.y, &src->row2.z);
//Platform_Log3("X: %f3, Y: %f3, Z: %f3", &src->row3.x, &src->row3.y, &src->row3.z);
//Platform_Log3("X: %f3, Y: %f3, Z: %f3", &src->row4.x, &src->row4.y, &src->row4.z);
//Platform_Log4("X: %f3, %f3, %f3, %f3", &src->row1.x, &src->row2.x, &src->row3.x, &src->row4.x);
//Platform_Log4("Y: %f3, %f3, %f3, %f3", &src->row1.y, &src->row2.y, &src->row3.y, &src->row4.y);
//Platform_Log4("Z: %f3, %f3, %f3, %f3", &src->row1.z, &src->row2.z, &src->row3.z, &src->row4.z);
//Platform_Log4("W: %f3, %f3, %f3, %f3", &src->row1.w, &src->row2.w, &src->row3.w, &src->row4.w);
//Platform_LogConst("====");
// Use w instead of z
// (row123.z = row123.w, only difference is row4.z/w being different)
MATRIX mtx;
mtx.t[0] = (int)(src->row4.x);
mtx.t[1] = (int)(src->row4.y);
mtx.t[2] = (int)(src->row4.w);
mtx.m[0][0] = ToFixed(src->row1.x);
mtx.m[0][1] = ToFixed(src->row1.y);
mtx.m[0][2] = ToFixed(src->row1.z);
mtx.m[0][2] = ToFixed(src->row1.w);
mtx.m[1][0] = ToFixed(src->row2.x);
mtx.m[1][1] = ToFixed(src->row2.y);
mtx.m[1][2] = ToFixed(src->row2.z);
mtx.m[1][2] = ToFixed(src->row2.w);
mtx.m[2][0] = ToFixed(src->row3.x);
mtx.m[2][1] = ToFixed(src->row3.y);
mtx.m[2][2] = ToFixed(src->row3.z);
mtx.m[2][2] = ToFixed(src->row3.w);
gte_SetRotMatrix(&mtx);
gte_SetTransMatrix(&mtx);
@ -655,6 +655,19 @@ static int Transform(IVec3* result, struct PS1VertexTextured* a) {
result->x = (x * 160 / w) + 160;
result->y = (y * -120 / w) + 120;
result->z = (z * OT_LENGTH / w);
/*SVECTOR coord;
POLY_FT4 poly;
coord.vx = a->x; coord.vy = a->y; coord.vz = a->z;
gte_ldv0(&coord);
gte_rtps();
gte_stsxy(&poly.x0);
int X = (short)poly.x0, Y = (short)poly.y0;
Platform_Log3("X: %i, %i, %i", &x, &result->x, &X);
Platform_Log3("Y: %i, %i, %i", &y, &result->y, &Y);
Platform_LogConst("=======");*/
return z > w;
}

View file

@ -460,6 +460,25 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) {
return res;
}
static void LogWifiStatus(int status) {
switch (status) {
case ASSOCSTATUS_SEARCHING:
Platform_LogConst("Wifi: Searching.."); return;
case ASSOCSTATUS_AUTHENTICATING:
Platform_LogConst("Wifi: Authenticating.."); return;
case ASSOCSTATUS_ASSOCIATING:
Platform_LogConst("Wifi: Connecting.."); return;
case ASSOCSTATUS_ACQUIRINGDHCP:
Platform_LogConst("Wifi: Acquiring.."); return;
case ASSOCSTATUS_ASSOCIATED:
Platform_LogConst("Wifi: Connected successfully!"); return;
case ASSOCSTATUS_CANNOTCONNECT:
Platform_LogConst("Wifi: FAILED TO CONNECT"); return;
default:
Platform_Log1("Wifi: status = %i", &status); return;
}
}
static void InitNetworking(void) {
#ifdef BUILD_DSI
if (!DSiWifi_InitDefault(INIT_ONLY)) {
@ -482,11 +501,10 @@ static void InitNetworking(void) {
#else
int status = Wifi_AssocStatus();
#endif
LogWifiStatus(status);
if (status == ASSOCSTATUS_ASSOCIATED) return;
Platform_Log1("STATUS: %i", &status);
if (status == ASSOCSTATUS_CANNOTCONNECT) {
Platform_LogConst("Can't connect to WIFI");
net_supported = false; return;
}
swiWaitForVBlank();

View file

@ -300,7 +300,7 @@ extern void ProcessVertexList(Vertex* v3, int n, void* sq_addr);
void SceneListSubmit(Vertex* v3, int n) {
sq = (uint32_t*)MEM_AREA_SQ_BASE;
for(int i = 0; i < n; ++i, ++v3)
for (int i = 0; i < n; i++, v3++)
{
PREFETCH(v3 + 1);
switch(v3->flags & 0xFF000000) {
@ -313,22 +313,12 @@ void SceneListSubmit(Vertex* v3, int n) {
continue;
};
// Quads [0, 1, 2, 3] -> Triangles [{0, 1, 2} {2, 3, 0}]
// Quads [0, 1, 2, 3] -> Triangles [{0, 1, 2} {2, 3, 0}]
Vertex* const v0 = v3 - 3;
Vertex* const v1 = v3 - 2;
Vertex* const v2 = v3 - 1;
uint8_t visible_mask = v3->flags & 0xFF;
// Stats gathering found that when testing a 64x64x64 sized world, at most
// ~400-500 triangles needed clipping
// ~13% of the triangles in a frame needed clipping (percentage increased when less triangles overall)
// Based on this, the decision was made to optimise for rendering quads there
// were either entirely visible or entirely culled, at the expensive at making
// partially visible quads a bit slower due to needing to be split into two triangles first
// Performance measuring indicated that overall FPS improved from this change
// to switching to try to process 1 quad instead of 2 triangles though
switch(visible_mask) {
case V0_VIS | V1_VIS | V2_VIS | V3_VIS: // All vertices visible
{