v1.1.2 with some more minor changes

This commit is contained in:
Mors 2021-04-14 11:31:56 +03:00
parent c92831567b
commit cba9a07e80
11 changed files with 158 additions and 124 deletions

79
FAQ.md Normal file
View file

@ -0,0 +1,79 @@
# Frequently Asked Questions
## **Q:** I can't build. I'm getting an error!
**A:** It seems like reinstalling MSYS2 and deleting the SM64Plus folder fixes the issues for most people. Disabling your antivirus could also help in some cases.
One other alternative you have is to use [sm64pcBuilder2](https://sm64pc.info/sm64pcbuilder2/) instead to build the game. Or you can also just compile the game manually, following the instructions from below.
If these don't help, you can ask for help on our Discord server. **Don't ask for help without following these steps first, and don't ask me help about sm64pcBuilder2 or building manually.**
<br>
## **Q:** I could build, but the game doesn't launch.
**A:** You can try rebuilding the game from the main menu. When asked to clear your build files, say yes.
<br>
## **Q:** The game is running too fast!
**A:** You can try to limit the game's FPS using Nvidia's control panel or other 3rd party tools. Make sure that you limit the "sm64.us.f3dex2e.exe"'s frame rate, and not the launcher's.
<br>
## **Q:** My controller doesn't work in the game. What do I do?
**A:** The game itself doesn't have support for DirectInput controllers yet. You can add it to your Steam library, which seems to make most controllers work. You can also use a tool like DS4Windows, BetterJoyForCemu, or 360ce depending on your controller.
<br>
## **Q:** I just updated the game and everything is black!
**A:** Hold "left", "right ", and "backspace" keys down for 4 seconds in the title screen and go through the setup once again.
<br>
## **Q:** Can I have a logo of the game?
**A:** [Sure.](https://cdn.discordapp.com/attachments/828684639618203688/828756298643931176/sm64plus-centred.png) Shoutouts to [Benial](https://twitter.com/Benial17) for doing such a good job with it.
<br>
## **Q:** Can I use mods with this?
**A:** Starting with version 1.1.0 there are 2 types of mods you can use.
**1) Texture Packs**
You can install custom texture packs by copying the texture files to the "C:\Users\YourUsername\AppData\Local\SM64Plus\gfx" folder. If you're asked to replace files, say yes. The folder layout and file names for the textures should be the same as what most other PC port forks. Make sure that the texture pack you're using has segmented skybox textures, otherwise you won't be able to see any differences with the skybox.
This feature is considered experimental and may have issues.
**1) Custom Models**
You can install custom model mods easily using [sm64pcBuilder2](https://sm64pc.info/sm64pcbuilder2/).
<br>
## **Q:** What about Render96?
**A:** The official Render96 texture pack works with SM64Plus, but lacks the segmented skybox textures. The models do not to work directly at the moment, but if you're willing to take on the challenge, it should be possible to fix the errors and make them work.
<br>
## **Q:** Is there Linux or Mac support?
**A:** Linux support is in works but needs further testing. There's no Mac support planned.
<br>
## **Q:** Is your game safe?
**A:** Yeah. If your antivirus is giving you any warnings, it's most likely false. You especially shouldn't trust Chrome on this kind of stuff.
<br>
## **Q:** Will Nintendo take this game down?
**A:** https://twitter.com/OfficialMFGG/status/1121019925521489920

103
README.md
View file

@ -20,94 +20,33 @@ This repo does **not** include all the assets necessary for compiling the game.
You can also build the game manually if you prefer to do so, or if you're not on a Windows platform. To do that, follow the instructions below.
Features that _might_ get added in the future:
- Discord Rich Presence support
- Smoother vertical camera movement
- Rumble
- Odyssey-like rolling
- Custom texture pack support
- Full OpenGL and SDL support
- Smoother vertical camera movement.
- Rumble support.
- Odyssey-like rolling and spin jump.
- Full OpenGL and SDL support.
- Full Linux support with launcher.
- Maybe even N64 support?
## FAQ
**Q:** I can't build. I'm getting an error!
**A:** It seems like reinstalling MSYS2 and deleting the SM64Plus folder fixes the issues for most people. Disabling your antivirus could also help in some cases.
One other alternative you have is to use [sm64pcBuilder2](https://sm64pc.info/sm64pcbuilder2/) instead to build the game. Or you can also just compile the game manually, following the instructions from below.
If these don't help, you can ask for help on our Discord server. **Don't ask for help without following these steps first, and don't ask me help about sm64pcBuilder2 or building manually.**
<br>
**Q:** I could build, but the game doesn't launch.
**A:** You can try rebuilding the game from the main menu. When asked to clear your build files, say yes.
<br>
**Q:** The game is running too fast!
**A:** You can try to limit the game's FPS using Nvidia's control panel or other 3rd party tools. Make sure that you limit the "sm64.us.f3dex2e.exe"'s frame rate, and not the launcher's.
<br>
**Q:** My controller doesn't work in the game. What do I do?
**A:** The game itself doesn't have support for DirectInput controllers yet. You can add it to your Steam library, which seems to make most controllers work. You can also use a tool like DS4Windows, BetterJoyForCemu, or 360ce depending on your controller.
<br>
**Q:** I just updated the game and everything is black!
**A:** Hold "left", "right ", and "backspace" keys down for 4 seconds in the title screen and go through the setup once again.
<br>
**Q:** Can I have a logo of the game?
**A:** [Sure](https://cdn.discordapp.com/attachments/828684639618203688/828756298643931176/sm64plus-centred.png). Shoutouts to [Benial](https://twitter.com/Benial17) for doing such a good job with it.
<br>
**Q:** Can I use mods with this?
**A:** Starting with version 1.1.0 there are 2 types of mods you can use.
**1) Texture Packs**
You can install custom texture packs by copying the texture files to the "C:\Users\YourUsername\AppData\Local\SM64Plus\gfx" folder. If you're asked to replace files, say yes. The folder layout and file names for the textures should be the same as what most other PC port forks. Make sure that the texture pack you're using has segmented skybox textures, otherwise you won't be able to see any differences with the skybox.
This feature is considered experimental and may have issues.
**2) Custom Models**
You can install custom model mods easily using [sm64pcBuilder2](https://sm64pc.info/sm64pcbuilder2/).
<br>
**Q:** What about Render96?
**A:** The official Render96 texture pack works with SM64Plus, but lacks the segmented skybox textures. The models are not tested but they should work as well.
<br>
**Q:** Is there Linux or Mac support?
**A:** Linux support is in works but needs further testing. There's no Mac support planned.
<br>
**Q:** Is your game safe?
**A:** Yeah. If your antivirus is giving you any warnings, it's most likely false. You especially shouldn't trust Chrome on this kind of stuff.
<br>
**Q:** Will Nintendo take this game down?
**A:** https://twitter.com/OfficialMFGG/status/1121019925521489920
[You can find the FAQ here.](https://github.com/MorsGames/sm64plus/blob/master/FAQ.md)
## Changelog
### v1.1.2 (14/04/2021):
**Launcher:**
- The launcher now deletes the "gfx" folder right before the initial building process.
**Additions:**
- Added "Moon Jump" as a debug setting.
**Changes:**
- Changed the "Nearest Neightbor Filtering" setting to "Texture Filtering", which includes 3-point filtering as an option as well.
- Made it so that missing textures now use a black and purple checkerboard pattern, similarly to the launcher.
**Fixes:**
- Fixed an error on Linux builds (hopefully).
### v1.1.1 (13/04/2021):
**Launcher:**
- Made the launcher automatically copy the texture files to the right place right before launching the game.

View file

@ -104,11 +104,11 @@ void my_rdp_init(void) {
gDPSetTextureLUT(gDisplayListHead++, G_TT_NONE);
gDPSetTextureDetail(gDisplayListHead++, G_TD_CLAMP);
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
if (gNearestNeighbor) {
gDPSetTextureFilter(gDisplayListHead++, G_TF_POINT);
if (gTextureFiltering) {
gDPSetTextureFilter(gDisplayListHead++, G_TF_BILERP);
}
else {
gDPSetTextureFilter(gDisplayListHead++, G_TF_BILERP);
gDPSetTextureFilter(gDisplayListHead++, G_TF_POINT);
}
gDPSetTextureConvert(gDisplayListHead++, G_TC_FILT);

View file

@ -1772,6 +1772,16 @@ s32 execute_mario_action(UNUSED struct Object *o) {
debug_update_mario_cap(CONT_RIGHT, MARIO_VANISH_CAP, 600, SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP));
}
// A very direct port of the famouse GS code using https://github.com/sm64gs2pc/sm64gs2pc#limitations
if (gMoonJump) {
if ((gControllers[0].buttonDown & 0xff) == 0x20)
*(uint32_t *) &gMarioStates[0].vel[1] = (*(uint32_t *) &gMarioStates[0].vel[1] & 0xffffffff0000ffff) | 0x42200000;
if ((*(uint32_t *) &gMarioStates[0].vel[1] & 0xff0000) == 0x200000)
gMarioStates[0].action = (gMarioStates[0].action & 0xffffffff0000ffff) | 0x3000000;
if ((*(uint32_t *) &gMarioStates[0].vel[1] & 0xff0000) == 0x200000)
gMarioStates[0].action = (gMarioStates[0].action & 0xffffffffffff0000) | 0x880;
}
if (gMarioState->action) {
gMarioState->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
mario_reset_bodystate(gMarioState);

View file

@ -150,7 +150,7 @@
#define DIK_MAIL 0xEC /* Mail */
#define DIK_MEDIASELECT 0xED /* Media Select */
char* gTitleString = "Super Mario 64 Plus v1.1.1";
char* gTitleString = "Super Mario 64 Plus v1.1.2";
s8 configFullscreen = 1;
unsigned int configCustomFullscreenResolution = 0;
@ -171,7 +171,7 @@ s8 g60FPS = 1;
s8 gDisableDrawDistance = 1;
float gDrawDistanceMultiplier = 1.0f;
s8 gDisableLowPoly = 1;
s8 gNearestNeighbor = 0;
unsigned int gTextureFiltering = 2;
unsigned int gNoiseType = 0;
s8 configForce4by3 = 0;
@ -252,6 +252,7 @@ s8 gForceLowPoly = 0;
s8 gDebugMovementMode = 0;
s8 gDebugCapChanger = 0;
s8 gMoonJump = 0;
s8 gVerticalCamera = 0;
unsigned int configButtonA = A_BUTTON;

View file

@ -20,7 +20,7 @@ extern s8 g60FPS;
extern s8 gDisableDrawDistance;
extern float gDrawDistanceMultiplier;
extern s8 gDisableLowPoly;
extern s8 gNearestNeighbor;
extern unsigned int gTextureFiltering;
extern unsigned int gNoiseType;
extern s8 configForce4by3;
@ -101,6 +101,7 @@ extern s8 gForceLowPoly;
extern s8 gDebugMovementMode;
extern s8 gDebugCapChanger;
extern s8 gMoonJump;
extern s8 gVerticalCamera;
extern unsigned int configButtonA;

View file

@ -57,7 +57,7 @@ static const struct ConfigOption options[] = {
{ .name = "disable_draw_distance", .type = CONFIG_TYPE_BOOL, .boolValue = &gDisableDrawDistance },
{ .name = "draw_distance_multiplier", .type = CONFIG_TYPE_FLOAT, .floatValue = &gDrawDistanceMultiplier },
{ .name = "disable_low_poly_mario", .type = CONFIG_TYPE_BOOL, .boolValue = &gDisableLowPoly },
{ .name = "nearest_neighbor_filtering", .type = CONFIG_TYPE_BOOL, .boolValue = &gNearestNeighbor },
{ .name = "texture_filtering", .type = CONFIG_TYPE_UINT, .uintValue = &gTextureFiltering },
{ .name = "noise_type", .type = CONFIG_TYPE_UINT, .uintValue = &gNoiseType },
{ .name = "force_4by3", .type = CONFIG_TYPE_BOOL, .boolValue = &configForce4by3 },
@ -150,6 +150,7 @@ static const struct ConfigOption options[] = {
{ .name = "show_debug_display", .type = CONFIG_TYPE_BOOL, .boolValue = &gShowDebugText },
{ .name = "debug_movement_mode", .type = CONFIG_TYPE_BOOL, .boolValue = &gDebugMovementMode },
{ .name = "debug_cap_changer", .type = CONFIG_TYPE_BOOL, .boolValue = &gDebugCapChanger },
{ .name = "moon_jump", .type = CONFIG_TYPE_BOOL, .boolValue = &gMoonJump },
{ .name = "show_debug_profiler", .type = CONFIG_TYPE_BOOL, .boolValue = &gShowProfiler },
{ .name = "vertical_analog_camera", .type = CONFIG_TYPE_BOOL, .boolValue = &gVerticalCamera },

View file

@ -29,7 +29,6 @@
#include "./game/settings.h"
#define THREE_POINT_FILTERING 0
#define DEBUG_D3D 0
using namespace Microsoft::WRL; // For ComPtr
@ -346,7 +345,7 @@ static struct ShaderProgram *gfx_d3d11_create_and_load_new_shader(uint32_t shade
char buf[4096];
size_t len, num_floats;
gfx_direct3d_common_build_shader(buf, len, num_floats, cc_features, false, THREE_POINT_FILTERING);
gfx_direct3d_common_build_shader(buf, len, num_floats, cc_features, false, gTextureFiltering == 1);
ComPtr<ID3DBlob> vs, ps;
ComPtr<ID3DBlob> error_blob;
@ -512,11 +511,12 @@ static void gfx_d3d11_set_sampler_parameters(int tile, bool linear_filter, uint3
D3D11_SAMPLER_DESC sampler_desc;
ZeroMemory(&sampler_desc, sizeof(D3D11_SAMPLER_DESC));
#if THREE_POINT_FILTERING
sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
#else
sampler_desc.Filter = linear_filter ? D3D11_FILTER_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_POINT;
#endif
if (gTextureFiltering == 1)
sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
else
sampler_desc.Filter = linear_filter ? D3D11_FILTER_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_POINT;
sampler_desc.AddressU = gfx_cm_to_d3d11(cms);
sampler_desc.AddressV = gfx_cm_to_d3d11(cmt);
sampler_desc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
@ -623,12 +623,12 @@ static void gfx_d3d11_draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_t
d3d.last_resource_views[i] = d3d.textures[d3d.current_texture_ids[i]].resource_view.Get();
d3d.context->PSSetShaderResources(i, 1, d3d.textures[d3d.current_texture_ids[i]].resource_view.GetAddressOf());
#if THREE_POINT_FILTERING
d3d.per_draw_cb_data.textures[i].width = d3d.textures[d3d.current_texture_ids[i]].width;
d3d.per_draw_cb_data.textures[i].height = d3d.textures[d3d.current_texture_ids[i]].height;
d3d.per_draw_cb_data.textures[i].linear_filtering = d3d.textures[d3d.current_texture_ids[i]].linear_filtering;
textures_changed = true;
#endif
if (gTextureFiltering == 1) {
d3d.per_draw_cb_data.textures[i].width = d3d.textures[d3d.current_texture_ids[i]].width;
d3d.per_draw_cb_data.textures[i].height = d3d.textures[d3d.current_texture_ids[i]].height;
d3d.per_draw_cb_data.textures[i].linear_filtering = d3d.textures[d3d.current_texture_ids[i]].linear_filtering;
textures_changed = true;
}
if (d3d.last_sampler_states[i].Get() != d3d.textures[d3d.current_texture_ids[i]].sampler_state.Get()) {
d3d.last_sampler_states[i] = d3d.textures[d3d.current_texture_ids[i]].sampler_state.Get();

View file

@ -14,6 +14,8 @@
#include <X11/XKBlib.h>
#include <X11/Xatom.h>
#include <PR/gbi.h>
#include "gfx_window_manager_api.h"
#include "gfx_screen_config.h"

View file

@ -52,6 +52,12 @@
#define MAX_LIGHTS 2
#define MAX_VERTICES 64
# define MAX_CACHED_TEXTURES 4096
# define HASH_SHIFT 0
#define HASHMAP_LEN (MAX_CACHED_TEXTURES * 2)
#define HASH_MASK (HASHMAP_LEN - 1)
struct RGBA {
uint8_t r, g, b, a;
};
@ -78,8 +84,8 @@ struct TextureHashmapNode {
bool linear_filter;
};
static struct {
struct TextureHashmapNode *hashmap[8192];
struct TextureHashmapNode pool[4096];
struct TextureHashmapNode *hashmap[HASHMAP_LEN];
struct TextureHashmapNode pool[MAX_CACHED_TEXTURES];
uint32_t pool_pos;
} gfx_texture_cache;
@ -172,24 +178,22 @@ static size_t buf_vbo_num_tris;
static struct GfxWindowManagerAPI *gfx_wapi;
static struct GfxRenderingAPI *gfx_rapi;
#include <time.h>
static unsigned long get_time(void) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (unsigned long)ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
}
// 4x4 pink-black checkerboard texture to indicate missing textures
#define MISSING_W 4
#define MISSING_H 4
static const uint8_t missing_texture[MISSING_W * MISSING_H * 4] = {
0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF,
0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF,
};
static void gfx_flush(void) {
if (buf_vbo_len > 0) {
int num = buf_vbo_num_tris;
unsigned long t0 = get_time();
gfx_rapi->draw_triangles(buf_vbo, buf_vbo_len, buf_vbo_num_tris);
buf_vbo_len = 0;
buf_vbo_num_tris = 0;
unsigned long t1 = get_time();
/*if (t1 - t0 > 1000) {
printf("f: %d %d\n", num, (int)(t1 - t0));
}*/
}
}
@ -286,7 +290,7 @@ static bool gfx_texture_cache_lookup(int tile, struct TextureHashmapNode **n, co
gfx_texture_cache.pool_pos = 0;
node = &gfx_texture_cache.hashmap[hash];
gReimportTextures = 0;
//puts("Clearing texture cache");
// puts("Clearing texture cache");
}
*node = &gfx_texture_cache.pool[gfx_texture_cache.pool_pos++];
if ((*node)->texture_addr == NULL) {
@ -492,7 +496,8 @@ static bool import_texture_custom(const char *path) {
if (data == NULL)
{
return FALSE;
gfx_rapi->upload_texture(missing_texture, MISSING_W, MISSING_H);
return TRUE;
}
// I'm so sorry for the mess you're about to witness. It was supposed to be a temporary thing but...
@ -665,10 +670,10 @@ static void import_texture(int tile) {
}
// Load the textures
char path2[1024];
snprintf(path2, sizeof(path2), "gfx/%s.png", (const char*)rdp.loaded_texture[tile].addr);
char path[1024];
snprintf(path, sizeof(path), "gfx/%s.png", (const char*)rdp.loaded_texture[tile].addr);
import_texture_custom(path2);
import_texture_custom(path);
/*if (fmt == G_IM_FMT_RGBA) {
if (siz == G_IM_SIZ_16b) {
@ -1920,12 +1925,9 @@ void gfx_run(Gfx *commands) {
}
dropped_frame = false;
double t0 = gfx_wapi->get_time();
gfx_rapi->start_frame();
gfx_run_dl(commands);
gfx_flush();
double t1 = gfx_wapi->get_time();
//printf("Process %f %f\n", t1, t1 - t0);
gfx_rapi->end_frame();
gfx_wapi->swap_buffers_begin();
}

View file

@ -305,7 +305,6 @@ void main_func(void) {
}
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
int WINAPI WinMain(UNUSED HINSTANCE hInstance, UNUSED HINSTANCE hPrevInstance, UNUSED LPSTR pCmdLine, UNUSED int nCmdShow) {
main_func();
return 0;