-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test of simple gfx hello_world using glank's gz.
- Loading branch information
1 parent
124b07a
commit 3d855e8
Showing
7 changed files
with
156 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# --------------------------------------------------------------------------- # | ||
# Author: Joey Dumont <[email protected]> # | ||
# Date: 2018-01-15 # | ||
# Description: CMake compilation instructions for the SM64 practice ROM. # | ||
# License: CC0 - Public Domain # | ||
# ----------------------------------------------------------------------------# | ||
|
||
# ----------------------------------------------------------------- # | ||
# -- Name and version of library -- # | ||
# ----------------------------------------------------------------- # | ||
set(uss64) | ||
set (USSR64_VERSION_MAJOR 0) | ||
set (USSR64_VERSION_MINOR 0) | ||
set (USSR64_VERSION_RELEASE 0) | ||
|
||
# ----------------------------------------------------------------- # | ||
# -- Configuration and Dependencies -- # | ||
# ----------------------------------------------------------------- # | ||
# -- Default build type | ||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Release) | ||
endif(NOT CMAKE_BUILD_TYPE) | ||
|
||
# -- CMake version and installation directory. | ||
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR) | ||
|
||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
set (CMAKE_INSTALL_PREFIX /opt/n64) | ||
endif() | ||
|
||
# -- Include CMake modules of this package. | ||
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules") | ||
|
||
# ----------------------------------------------------------------- # | ||
# -- Compiler Configuration -- # | ||
# ----------------------------------------------------------------- # | ||
set (CMAKE_C_FLAGS_RELEASE "-G 0 -O2 -Wall -mtune=vr4300 -march=vr4300 -mabi=32") | ||
set (CMAKE_CXX_FLAGS_RELEASE "-G 0 -O2 -Wall -mtune=vr4300 -march=vr4300 -mabi=32") | ||
|
||
add_definitions(-DZ64_VERSION=Z64_OOT10) | ||
|
||
# ----------------------------------------------------------------- # | ||
# -- Compilation Instructions -- # | ||
# ----------------------------------------------------------------- # | ||
# -- Included files. | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) | ||
include_directories(/opt/n64-dev/n64-sysroot/include) | ||
|
||
# -- Create object. | ||
add_library(uss64 OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/hello_world.c) | ||
|
||
# ----------------------------------------------------------------- # | ||
# -- Installation Instructions -- # | ||
# ----------------------------------------------------------------- # | ||
|
||
# -- Output binaries in directory | ||
set (CMAKE_OBJECTS_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | ||
install (TARGETS uss64 OBJECTS DESTINATION bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# --------------------------------------------------------------------------- # | ||
# Author: Joey Dumont <[email protected]> # | ||
# Date: 2018-02-14 # | ||
# Description: Toolchain file for MIPS64 on Linux. # | ||
# License: CC0 - Public Domain # | ||
# ----------------------------------------------------------------------------# | ||
|
||
set (CMAKE_SYSTEM_NAME Generic) | ||
set (CMAKE_SYSTEM_PROCESSOR mips64) | ||
|
||
set (CMAKE_C_COMPILER mips64-gcc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# --------------------------------------------------------------------------- # | ||
# Author: Joey Dumont <[email protected]> # | ||
# Date: 2018-02-14 # | ||
# Description: Simple build script. # | ||
# License: CC0 - Public Domain # | ||
# ----------------------------------------------------------------------------# | ||
|
||
# Check the number of arguments. | ||
if [ $# -gt 2 ]; then | ||
printf "Usage is\n" | ||
printf "\tbash build.sh release/debug [toolchain-file]\n" | ||
exit 1 | ||
fi | ||
|
||
# Change to file directory. | ||
cd "$(dirname "$(readlink -f "$0")")"; | ||
|
||
# Check if build/ dir exists. | ||
if [ ! -d build ]; then | ||
mkdir build | ||
else | ||
rm -rf build | ||
mkdir build | ||
fi | ||
|
||
# Change to build dir and compile the library. | ||
cd build | ||
CMAKE_FLAGS= | ||
CMAKE_TOOLCHAIN_FILE= | ||
if [ $# -gt 0 ]; then | ||
if [ $1 == release ]; then | ||
CMAKE_FLAGS="${CMAKE_FLAGS} -DCMAKE_BUILD_TYPE=Release" | ||
elif [ $1 == debug ]; then | ||
CMAKE_FLAGS="${CMAKE_FLAGS} -DCMAKE_BUILD_TYPE=Debug" | ||
fi | ||
fi | ||
|
||
if [ $# -gt 1 ]; then | ||
CMAKE_TOOLCHAIN_FILE=$1 | ||
else | ||
CMAKE_TOOLCHAIN_FILE=../Toolchain-mips64-linux-x86_64.cmake | ||
fi | ||
|
||
cmake ${CMAKE_FLAGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
cd $(dirname $(readlink -f $0)) | ||
mips64-gcc -G 0 -Wall -O2 -mtune=vr4300 -march=vr4300 -mabi=32 -c -I /opt/n64-dev/n64-sysroot/include hello_world.c -o hello_world.o | ||
grc gz/res/gz/fipps.png -d gz/res/resources.json -o fipps.png.o | ||
mips64-gcc -G 0 -Wall -O2 -mtune=vr4300 -march=vr4300 -mabi=32 -c /opt/n64-dev/n64-sysroot/include/grc.c -o grc.o | ||
mips64-gcc -G 0 -Wall -O2 -mtune=vr4300 -march=vr4300 -mabi=32 -c /opt/n64-dev/n64-sysroot/include/vector/vector.c -o vector.o | ||
mips64-gcc -G 0 -Wall -O2 -mtune=vr4300 -march=vr4300 -mabi=32 -c /opt/n64-dev/n64-sysroot/include/startup.c -o startup.o | ||
mips64-gcc -DZ64_VERSION=Z64_OOT10 -G 0 -Wall -O2 -mtune=vr4300 -march=vr4300 -mabi=32 -c -I /opt/n64-dev/n64-sysroot/include hello_world.c -o hello_world.o | ||
mips64-gcc -DZ64_VERSION=Z64_OOT10 -G 0 -Wall -O2 -mtune=vr4300 -march=vr4300 -mabi=32 -c -I /opt/n64-dev/n64-sysroot/include gz/src/gz/resource.c -o resource.o | ||
mips64-gcc -DZ64_VERSION=Z64_OOT10 -G 0 -Wall -O2 -mtune=vr4300 -march=vr4300 -mabi=32 -c -I /opt/n64-dev/n64-sysroot/include gz/src/gz/gfx.c -o gfx.o | ||
mips64-gcc -DZ64_VERSION=Z64_OOT10 -G 0 -Wall -O2 -mtune=vr4300 -march=vr4300 -mabi=32 -c -I /opt/n64-dev/n64-sysroot/include gz/src/gz/gu.c -o gu.o | ||
mips64-gcc -DZ64_VERSION=Z64_OOT10 -G 0 -Wall -O2 -mtune=vr4300 -march=vr4300 -mabi=32 -c -I /opt/n64-dev/n64-sysroot/include gz/src/gz/zu.c -o zu.o | ||
mips64-g++ -T /opt/n64-dev/n64-sysroot/lib/gl-n64.ld -nostartfiles -specs=nosys.specs -O3 -flto -Wl,--gc-sections -Wl,--defsym,start=0x80400000 \ | ||
hello_world.o resource.o gfx.o gu.o grc.o zu.o vector.o startup.o -o uss64.o | ||
mips64-objcopy -O binary uss64.elf uss64.bin |
Submodule gz
updated
30 files
+46 −0 | INSTALL.md | |
+353 −0 | USAGE.md | |
+44 −0 | genhooks | |
+201 −0 | gz.cbp | |
+142 −0 | makefile | |
+4 −0 | oot-1.0/patch/mem_patch.gsc | |
+6 −0 | oot-1.0/upload | |
+9 −0 | oot-1.0/upload.bat | |
+4 −0 | oot-1.1/patch/mem_patch.gsc | |
+6 −0 | oot-1.1/upload | |
+9 −0 | oot-1.1/upload.bat | |
+4 −0 | oot-1.2/patch/mem_patch.gsc | |
+6 −0 | oot-1.2/upload | |
+9 −0 | oot-1.2/upload.bat | |
+14 −0 | patch/lua/make-patch.lua | |
+14 −0 | patch/lua/make-rom.lua | |
+45 −0 | patch/lua/make.lua | |
+34 −0 | patch/lua/patch.lua | |
+59 −0 | patch/lua/rom_table.lua | |
+6 −0 | patch/make-patch | |
+8 −0 | patch/make-patch.bat | |
+5 −0 | patch/make-rom | |
+7 −0 | patch/make-rom.bat | |
+6 −0 | patch/patch | |
+8 −0 | patch/patch.bat | |
+63 −34 | src/gz/gz.c | |
+12 −0 | src/gz/settings.c | |
+12 −0 | src/gz/settings.h | |
+14 −0 | src/gz/watchlist.c | |
+27 −0 | src/ldr/ldr.S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,42 @@ | ||
#include <stddef.h> | ||
#include <n64.h> | ||
#include <startup.h> | ||
#include "gz/src/gz/z64.h" | ||
#include "gz/src/gz/resource.h" | ||
#include "gz/src/gz/gfx.h" | ||
|
||
extern void PrintXY(unsigned int x, unsigned int y, const char *str); | ||
static const char HelloString[] = "- hello n64 -"; | ||
static unsigned int x = 32; | ||
static unsigned int y = 32; | ||
static _Bool _ready = 0; | ||
|
||
void MainHook(void) | ||
static struct gfx_font *font; | ||
|
||
// Try to write Hello World using native GFx. | ||
ENTRY void _start(void) | ||
{ | ||
if (!_ready) | ||
{ | ||
/* initialize gfx */ | ||
{ | ||
gfx_start(); | ||
gfx_mode_configure(GFX_MODE_FILTER, G_TF_POINT); | ||
gfx_mode_configure(GFX_MODE_COMBINE, G_CC_MODE(G_CC_MODULATEIA_PRIM, | ||
G_CC_MODULATEIA_PRIM)); | ||
} | ||
|
||
font = resource_get(RES_FONT_FIPPS); | ||
_ready = 1; | ||
} | ||
|
||
gfx_mode_init(); | ||
gfx_printf(font, x, y, HelloString); | ||
|
||
|
||
// Lives back to normal position | ||
//PrintXY(0x36, 0xD1, (void*)0x80338388, *(int16_t*)0x8033B260); | ||
|
||
// Print hello world | ||
PrintXY(x, y, HelloString); | ||
//PrintXY(x, y, HelloString); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters