mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Nintendo 64 port somewhat works
This commit is contained in:
parent
029b6d80de
commit
87d4d84107
9 changed files with 49 additions and 17 deletions
|
@ -5,14 +5,17 @@ SOURCE_DIR = src
|
|||
N64_ROM_TITLE = "ClassiCube"
|
||||
N64_ROM_RTC = true
|
||||
|
||||
include $(N64_INST)/include/n64.mk
|
||||
|
||||
CFILES := $(notdir $(wildcard src/*.c))
|
||||
OFILES := $(CFILES:.c=.o)
|
||||
OBJS := $(addprefix $(BUILD_DIR)/,$(OFILES))
|
||||
CFLAGS := "-DNINTENDO64 -Wno-error=missing-braces"
|
||||
CFLAGS := "-Wno-error=missing-braces -Wno-error=maybe-uninitialized"
|
||||
|
||||
include $(N64_INST)/include/n64.mk
|
||||
|
||||
ClassiCube-n64.z64: N64_ROM_TITLE = "ClassiCube"
|
||||
ClassiCube-n64.z64: $(BUILD_DIR)/filesystem.dfs
|
||||
|
||||
$(BUILD_DIR)/filesystem.dfs: misc/n64/default.zip
|
||||
|
||||
$(BUILD_DIR)/ClassiCube-n64.elf: $(OBJS)
|
||||
|
||||
|
|
BIN
misc/n64/default.zip
Normal file
BIN
misc/n64/default.zip
Normal file
Binary file not shown.
12
readme.md
12
readme.md
|
@ -83,6 +83,7 @@ And also runs on:
|
|||
* PS Vita - unfinished, rendering issues (if you have a GitHub account, can [download from here](https://github.com/UnknownShadow200/ClassiCube/actions/workflows/build_vita.yml))
|
||||
* Xbox - unfinished, major rendering issues (if you have a GitHub account, can [download from here](https://github.com/UnknownShadow200/ClassiCube/actions/workflows/build_xbox.yml))
|
||||
* PS3 - unfinished, rendering issues
|
||||
* Nintendo 64 - unfinished, major rendering issues
|
||||
|
||||
# Compiling
|
||||
|
||||
|
@ -293,6 +294,14 @@ Run `make dreamcast`. You'll need [KallistiOS](https://github.com/KallistiOS/Kal
|
|||
|
||||
The Dreamcast port needs assistance from someone experienced with Dreamcast homebrew development - if you're interested, please get in contact with me. (`unknownshadow200` on Discord)
|
||||
|
||||
#### Nintendo 64
|
||||
|
||||
Run `make n64`. You'll need the opengl branch of [libdragon](https://github.com/DragonMinded/libdragon/tree/opengl)
|
||||
|
||||
The Nintendo 64 port needs assistance from someone experienced with Nintendo 64 homebrew development - if you're interested, please get in contact with me. (`unknownshadow200` on Discord)
|
||||
|
||||
You'll also need to stub out `WorkerLoop` function in `Http_Worker.c` for now
|
||||
|
||||
##### Other
|
||||
|
||||
You'll have to write the necessary code. You should read portability.md in doc folder.
|
||||
|
@ -347,6 +356,9 @@ Further information (e.g. style) for ClassiCube's source code can be found in th
|
|||
* [nxdk](https://github.com/XboxDev/nxdk) - Backend for Xbox
|
||||
* [xemu](https://github.com/xemu-project/xemu) - Emulator used to test Xbox port
|
||||
* [cxbx-reloaded](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded) - Emulator used to test Xbox port
|
||||
* [libdragon](https://github.com/DragonMinded/libdragon) - Backend for Nintendo 64
|
||||
* [cen64](https://github.com/n64dev/cen64) - Emulator used to test Nintendo 64 port
|
||||
* [ares](https://github.com/ares-emulator/ares) - Emulator used to test Nintendo 64 port
|
||||
|
||||
|
||||
## Sound Credits
|
||||
|
|
|
@ -475,6 +475,7 @@
|
|||
<ClCompile Include="Graphics_PS3.c" />
|
||||
<ClCompile Include="Graphics_PSP.c" />
|
||||
<ClCompile Include="Graphics_PSVita.c" />
|
||||
<ClCompile Include="Graphics_SoftGPU.c" />
|
||||
<ClCompile Include="Graphics_Xbox.c" />
|
||||
<ClCompile Include="Gui.c" />
|
||||
<ClCompile Include="HeldBlockRenderer.c" />
|
||||
|
|
|
@ -686,6 +686,9 @@
|
|||
<ClCompile Include="Window_N64.c">
|
||||
<Filter>Source Files\Window</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Graphics_SoftGPU.c">
|
||||
<Filter>Source Files\Graphics</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\misc\windows\CCicon.rc">
|
||||
|
|
|
@ -304,7 +304,7 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_LOWMEM
|
||||
#define CC_BUILD_BEARSSL
|
||||
#undef CC_BUILD_FREETYPE
|
||||
#elif defined NINTENDO64
|
||||
#elif defined N64
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_N64
|
||||
|
|
|
@ -127,6 +127,7 @@ static GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, cc_uint8 flags, cc_boo
|
|||
|
||||
glGenTextures(1, &tex->textureID);
|
||||
glBindTexture(GL_TEXTURE_2D, tex->textureID);
|
||||
// NOTE: Enabling these fixes textures, but seems to break on cen64
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
|
@ -207,8 +208,8 @@ void Gfx_SetColWriteMask(cc_bool r, cc_bool g, cc_bool b, cc_bool a) {
|
|||
//glColorMask(r, g, b, a); TODO
|
||||
}
|
||||
|
||||
void Gfx_SetDepthWrite(cc_bool enabled) { }
|
||||
void Gfx_SetDepthTest(cc_bool enabled) { }
|
||||
void Gfx_SetDepthWrite(cc_bool enabled) { glDepthMask(enabled); }
|
||||
void Gfx_SetDepthTest(cc_bool enabled) { gl_Toggle(GL_DEPTH_TEST); }
|
||||
|
||||
static void Gfx_FreeState(void) { FreeDefaultResources(); }
|
||||
static void Gfx_RestoreState(void) {
|
||||
|
|
|
@ -42,8 +42,8 @@ cc_uint64 Stopwatch_Measure(void) {
|
|||
}
|
||||
|
||||
void Platform_Log(const char* msg, int len) {
|
||||
write(STDOUT_FILENO, msg, len);
|
||||
write(STDOUT_FILENO, "\n", 1);
|
||||
write(STDERR_FILENO, msg, len);
|
||||
write(STDERR_FILENO, "\n", 1);
|
||||
}
|
||||
|
||||
#define UnixTime_TotalMS(time) ((cc_uint64)time.tv_sec * 1000 + UNIX_EPOCH + (time.tv_usec / 1000))
|
||||
|
@ -69,12 +69,17 @@ void DateTime_CurrentLocal(struct DateTime* t) {
|
|||
/*########################################################################################################################*
|
||||
*-----------------------------------------------------Directory/File------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static const cc_string root_path = String_FromConst("");
|
||||
static const cc_string root_path = String_FromConst("/");
|
||||
|
||||
static void GetNativePath(char* str, const cc_string* path) {
|
||||
// TODO temp hack
|
||||
cc_string path_ = *path;
|
||||
int idx = String_IndexOf(path, '/');
|
||||
if (idx >= 0) path_ = String_UNSAFE_SubstringAt(&path_, idx + 1);
|
||||
|
||||
Mem_Copy(str, root_path.buffer, root_path.length);
|
||||
str += root_path.length;
|
||||
String_EncodeUtf8(str, path);
|
||||
String_EncodeUtf8(str, &path_);
|
||||
}
|
||||
|
||||
cc_result Directory_Create(const cc_string* path) {
|
||||
|
@ -93,11 +98,12 @@ static cc_result File_Do(cc_file* file, const cc_string* path) {
|
|||
char str[NATIVE_STR_LEN];
|
||||
GetNativePath(str, path);
|
||||
|
||||
*file = -1;
|
||||
return ReturnCode_FileNotFound;
|
||||
//*file = -1;
|
||||
//return ReturnCode_FileNotFound;
|
||||
// TODO: Why does trying this code break everything
|
||||
|
||||
int ret = dfs_open(str);
|
||||
Platform_Log2("Opened %c = %i", str, &ret);
|
||||
if (ret < 0) { *file = -1; return ret; }
|
||||
|
||||
*file = ret;
|
||||
|
|
|
@ -134,16 +134,16 @@ cc_bool Atlas_TryChange(struct Bitmap* atlas) {
|
|||
if (!Game_ValidateBitmapPow2(&terrain, atlas)) return false;
|
||||
tileSize = atlas->width / ATLAS2D_TILES_PER_ROW;
|
||||
|
||||
if (atlas->height < atlas->width) {
|
||||
Chat_AddRaw("&cUnable to use terrain.png from the texture pack.");
|
||||
Chat_AddRaw("&c Its height is less than its width.");
|
||||
return false;
|
||||
}
|
||||
if (tileSize <= 0) {
|
||||
Chat_AddRaw("&cUnable to use terrain.png from the texture pack.");
|
||||
Chat_AddRaw("&c It must be 16 or more pixels wide.");
|
||||
return false;
|
||||
}
|
||||
if (atlas->height < tileSize) {
|
||||
Chat_AddRaw("&cUnable to use terrain.png from the texture pack.");
|
||||
Chat_AddRaw("&c It must have at least one row in it.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tileSize > Gfx.MaxTexWidth) {
|
||||
Chat_AddRaw("&cUnable to use terrain.png from the texture pack.");
|
||||
|
@ -151,6 +151,12 @@ cc_bool Atlas_TryChange(struct Bitmap* atlas) {
|
|||
&tileSize, &tileSize, &Gfx.MaxTexWidth, &Gfx.MaxTexHeight);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (atlas->height < atlas->width) {
|
||||
/* Probably wouldn't want to use these, but you still can technically */
|
||||
Chat_AddRaw("&cHeight of terrain.png is less than its width.");
|
||||
Chat_AddRaw("&c Some tiles will therefore appear completely white.");
|
||||
}
|
||||
if (atlas->width > Gfx.MaxTexWidth) {
|
||||
/* Super HD textures probably won't work great on this GPU */
|
||||
Chat_AddRaw("&cYou may experience significantly reduced performance.");
|
||||
|
|
Loading…
Reference in a new issue