Merge branch 'master' into master
This commit is contained in:
commit
6281e00891
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -7,6 +7,10 @@
|
||||||
*.ilk
|
*.ilk
|
||||||
*.exp
|
*.exp
|
||||||
|
|
||||||
|
# Patch and wiggle related residdue
|
||||||
|
*.rej
|
||||||
|
*.porig
|
||||||
|
|
||||||
# Precompiled Headers
|
# Precompiled Headers
|
||||||
*.gch
|
*.gch
|
||||||
*.pch
|
*.pch
|
||||||
|
@ -41,6 +45,7 @@
|
||||||
# Text editor remnants
|
# Text editor remnants
|
||||||
*.swp
|
*.swp
|
||||||
.vscode/*
|
.vscode/*
|
||||||
|
.idea/*
|
||||||
|
|
||||||
# General project-specific ignores
|
# General project-specific ignores
|
||||||
doxygen/doxygen/*
|
doxygen/doxygen/*
|
||||||
|
|
8
Makefile
8
Makefile
|
@ -263,14 +263,11 @@ ifeq ($(TARGET_RPI),1)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
# RPi3 or RPi4, in ARM64 (aarch64) mode. NEEDS TESTING 32BIT.
|
# RPi3 or RPi4, in ARM64 (aarch64) mode. NEEDS TESTING 32BIT.
|
||||||
# DO NOT pass -mfpu stuff here, thats for 32bit ARM only and will fail for 64bit ARM.
|
# DO NOT pass -mfpu stuff here, thats for 32bit ARM only and will fail for 64bit ARM.
|
||||||
|
ifneq (,$(findstring aarch64,$(machine)))
|
||||||
ifneq (,$(findstring aarch64,$(machine)))
|
|
||||||
model = $(shell sh -c 'cat /sys/firmware/devicetree/base/model 2>/dev/null || echo unknown')
|
model = $(shell sh -c 'cat /sys/firmware/devicetree/base/model 2>/dev/null || echo unknown')
|
||||||
|
ifneq (,$(findstring 3,$(model)))
|
||||||
ifneq (,$(findstring 3,$(model)))
|
|
||||||
OPT_FLAGS := -march=armv8-a+crc -mtune=cortex-a53 -O3
|
OPT_FLAGS := -march=armv8-a+crc -mtune=cortex-a53 -O3
|
||||||
else ifneq (,$(findstring 4,$(model)))
|
else ifneq (,$(findstring 4,$(model)))
|
||||||
OPT_FLAGS := -march=armv8-a+crc+simd -mtune=cortex-a72 -O3
|
OPT_FLAGS := -march=armv8-a+crc+simd -mtune=cortex-a72 -O3
|
||||||
|
@ -554,7 +551,6 @@ $(BUILD_DIR)/text/%/define_text.inc.c: text/define_text.inc.c text/%/courses.h t
|
||||||
$(CPP) $(VERSION_CFLAGS) $< -o $@ -I text/$*/
|
$(CPP) $(VERSION_CFLAGS) $< -o $@ -I text/$*/
|
||||||
$(TEXTCONV) charmap.txt $@ $@
|
$(TEXTCONV) charmap.txt $@ $@
|
||||||
|
|
||||||
|
|
||||||
ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS) $(GODDARD_SRC_DIRS) $(ULTRA_SRC_DIRS) $(ULTRA_ASM_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(TEXT_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) include) $(MIO0_DIR) $(addprefix $(MIO0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION)
|
ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS) $(GODDARD_SRC_DIRS) $(ULTRA_SRC_DIRS) $(ULTRA_ASM_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(TEXT_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) include) $(MIO0_DIR) $(addprefix $(MIO0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION)
|
||||||
|
|
||||||
# Make sure build directory exists before compiling anything
|
# Make sure build directory exists before compiling anything
|
||||||
|
|
58
README.md
58
README.md
|
@ -61,11 +61,67 @@ Run `make` to build (defaults to `VERSION=us`)
|
||||||
```
|
```
|
||||||
make VERSION=jp -j6 # build (J) version with 6 jobs
|
make VERSION=jp -j6 # build (J) version with 6 jobs
|
||||||
make VERSION=us WINDOWS_BUILD=1 # builds a (U) Windows executable
|
make VERSION=us WINDOWS_BUILD=1 # builds a (U) Windows executable
|
||||||
|
make TARGET_RPI=1 # targets an executable for a Raspberry Pi
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Windows
|
### On Windows
|
||||||
|
|
||||||
A full guide is to be written. You can use [mxe](https://mxe.cc/) and MinGW.
|
#### 1. Set up MSYS2, following [this guide](https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&-MSYS2).
|
||||||
|
|
||||||
|
#### 2. Install dependencies
|
||||||
|
```
|
||||||
|
pacman -S mingw-w64-i686-glew mingw-w64-x86_64-glew mingw-w64-i686-SDL2 mingw-w64-x86_64-SDL2 python3
|
||||||
|
```
|
||||||
|
#### 3. Copy baserom(s) for asset extraction
|
||||||
|
|
||||||
|
For each version (jp/us/eu) that you want to build an executable for, put an existing ROM at
|
||||||
|
`./baserom.<version>.z64` for asset extraction.
|
||||||
|
|
||||||
|
#### 4. On MSYS2, navigate to the sm64pc folder and then enter `./tools/audiofile-0.3.6/`. Inside this directory, run
|
||||||
|
```
|
||||||
|
autoreconf -i
|
||||||
|
```
|
||||||
|
|
||||||
|
Only leave this directory on step 9.
|
||||||
|
|
||||||
|
#### 5. Run the `configure` script
|
||||||
|
```
|
||||||
|
PATH=/mingw64/bin:/mingw32/bin:$PATH LIBS=-lstdc++ ./configure --disable-docs
|
||||||
|
```
|
||||||
|
#### 6. Run the `make` script
|
||||||
|
```
|
||||||
|
PATH=/mingw64/bin:/mingw32/bin:$PATH make
|
||||||
|
```
|
||||||
|
#### 7. Create a lib directory in `tools/`
|
||||||
|
```
|
||||||
|
mkdir ../lib
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 8. Copy the compiled libaudiofile to `tools/lib/`
|
||||||
|
```
|
||||||
|
cp libaudiofile/.libs/libaudiofile.a ../lib/
|
||||||
|
cp libaudiofile/.libs/libaudiofile.la ../lib/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 9. Navigate back to `tools/`, then alter the `Makefile` and add `-lstdc++` on the following line
|
||||||
|
```
|
||||||
|
tabledesign_CFLAGS := -Wno-uninitialized -laudiofile -lstdc++
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 10. Run `make`
|
||||||
|
```
|
||||||
|
PATH=/mingw64/bin:/mingw32/bin:$PATH make
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 11. Navigate back to the sm64pc root directory.
|
||||||
|
|
||||||
|
#### 12. Finally, run `make` once more.
|
||||||
|
|
||||||
|
(Note that mingw32 and mingw64 have been swapped. This is so you can build the 32bit application successfully.)
|
||||||
|
|
||||||
|
```
|
||||||
|
PATH=/mingw32/bin:/mingw64/bin:$PATH make
|
||||||
|
```
|
||||||
|
|
||||||
### For the web
|
### For the web
|
||||||
|
|
||||||
|
|
|
@ -78,14 +78,29 @@ const SDL_Scancode scancode_rmapping_nonextended[][2] = {
|
||||||
{SDL_SCANCODE_KP_MULTIPLY, SDL_SCANCODE_PRINTSCREEN}
|
{SDL_SCANCODE_KP_MULTIPLY, SDL_SCANCODE_PRINTSCREEN}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void gfx_sdl_set_fullscreen(bool fullscreen)
|
||||||
|
{
|
||||||
|
if (fullscreen)
|
||||||
|
{
|
||||||
|
SDL_SetWindowFullscreen(wnd, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SDL_SetWindowFullscreen(wnd, 0);
|
||||||
|
SDL_ShowCursor(SDL_ENABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
configFullscreen = fullscreen;
|
||||||
|
}
|
||||||
|
|
||||||
static void gfx_sdl_init(void) {
|
static void gfx_sdl_init(void) {
|
||||||
SDL_Init(SDL_INIT_VIDEO);
|
SDL_Init(SDL_INIT_VIDEO);
|
||||||
SDL_ShowCursor(SDL_DISABLE); // Removes the cursor from view when upon the game's window.
|
|
||||||
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
|
|
||||||
#ifdef TARGET_RPI
|
#ifdef USE_GLES
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); // These attributes allow for hardware acceleration on RPis.
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); // These attributes allow for hardware acceleration on RPis.
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||||
|
@ -94,21 +109,18 @@ static void gfx_sdl_init(void) {
|
||||||
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||||
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
||||||
|
|
||||||
#ifndef TARGET_RPI
|
#ifndef USE_GLES
|
||||||
wnd = SDL_CreateWindow("Super Mario 64 PC-Port", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
wnd = SDL_CreateWindow("Super Mario 64 PC port (OpenGL)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||||
DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
||||||
#else
|
#else
|
||||||
wnd = SDL_CreateWindow("Super Mario 64 RPi (GLES2)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
wnd = SDL_CreateWindow("Super Mario 64 PC port (OpenGL_ES2)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||||
DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (configFullscreen)
|
gfx_sdl_set_fullscreen(configFullscreen);
|
||||||
{
|
|
||||||
SDL_SetWindowFullscreen(wnd, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_GL_CreateContext(wnd);
|
SDL_GL_CreateContext(wnd);
|
||||||
SDL_GL_SetSwapInterval(2); // TODO 0, 1 or 2 or remove this line
|
SDL_GL_SetSwapInterval(1); // We have a double buffered GL context, it makes no sense to want tearing.
|
||||||
|
|
||||||
for (size_t i = 0; i < sizeof(windows_scancode_table) / sizeof(SDL_Scancode); i++) {
|
for (size_t i = 0; i < sizeof(windows_scancode_table) / sizeof(SDL_Scancode); i++) {
|
||||||
inverted_scancode_table[windows_scancode_table[i]] = i;
|
inverted_scancode_table[windows_scancode_table[i]] = i;
|
||||||
|
@ -156,16 +168,11 @@ static void gfx_sdl_onkeydown(int scancode) {
|
||||||
|
|
||||||
if (state[SDL_SCANCODE_LALT] && state[SDL_SCANCODE_RETURN])
|
if (state[SDL_SCANCODE_LALT] && state[SDL_SCANCODE_RETURN])
|
||||||
{
|
{
|
||||||
if (!configFullscreen)
|
gfx_sdl_set_fullscreen(!configFullscreen);
|
||||||
{
|
}
|
||||||
SDL_SetWindowFullscreen(wnd, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
else if (state[SDL_SCANCODE_ESCAPE] && configFullscreen)
|
||||||
}
|
{
|
||||||
else
|
gfx_sdl_set_fullscreen(false);
|
||||||
{
|
|
||||||
SDL_SetWindowFullscreen(wnd, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
configFullscreen = !configFullscreen;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user