Skip to content

Commit

Permalink
[WEB] fix firefox mobile, chrome mobile, fix opera mobile
Browse files Browse the repository at this point in the history
see issues linked below for more details.

fixes #88, fixes #89, fixes #90
  • Loading branch information
ITotalJustice committed Sep 6, 2022
1 parent d10c7c4 commit c4fb449
Show file tree
Hide file tree
Showing 12 changed files with 575 additions and 134 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy_netlify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:

- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v11
with:
version: '3.1.20'

- name: Cmake Build
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/deploy_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:

- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v11
with:
version: '3.1.20'

- name: Cmake Build
run: |
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ option(FRONTEND "enable frontend build" OFF)
option(SDL2 "basic sdl2 frontend" OFF)
option(IMGUI "imgui frontend" OFF)
option(BENCHMARK "benchmark frontend" OFF)
option(NATIVE "enable native build" OFF)

if (SDL2)
set(FRONTEND ON)
Expand Down
26 changes: 18 additions & 8 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,55 +121,65 @@
"name": "emsdk",
"displayName": "emsdk",
"inherits": ["core"],
"toolchainFile": "$env{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
"toolchainFile": "$env{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake",
"cacheVariables": {
"INTERPRETER": "INTERPRETER_TABLE",
"LTO": false
}
},
{
"name": "emsdk-dev",
"displayName": "emsdk-dev",
"inherits": ["core-dev"],
"toolchainFile": "$env{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake",
"cacheVariables": {
"EMRUN": true
"EMRUN": true,
"INTERPRETER": "INTERPRETER_TABLE"
}
},
{
"name": "benchmark",
"displayName": "benchmark",
"inherits": ["core"],
"cacheVariables": {
"BENCHMARK": true
"BENCHMARK": true,
"NATIVE": true
}
},
{
"name": "benchmark-dev",
"displayName": "benchmark-dev",
"inherits": ["core-dev"],
"cacheVariables": {
"BENCHMARK": true
"BENCHMARK": true,
"NATIVE": true
}
},
{
"name": "sdl2-table",
"displayName": "sdl2-table",
"inherits": ["sdl2"],
"cacheVariables": {
"INTERPRETER": "INTERPRETER_TABLE"
"INTERPRETER": "INTERPRETER_TABLE",
"NATIVE": true
}
},
{
"name": "sdl2-switch",
"displayName": "sdl2-switch",
"inherits": ["sdl2"],
"inherits": ["sdl2", "clang"],
"cacheVariables": {
"INTERPRETER": "INTERPRETER_SWITCH"
"INTERPRETER": "INTERPRETER_SWITCH",
"NATIVE": true
}
},
{
"name": "sdl2-goto",
"displayName": "sdl2-goto",
"inherits": ["sdl2"],
"cacheVariables": {
"INTERPRETER": "INTERPRETER_GOTO"
"INTERPRETER": "INTERPRETER_GOTO",
"NATIVE": true
}
},
{
Expand Down
22 changes: 19 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ list(APPEND clang_flags
# -fno-rtti
-fno-exceptions

# # can try enabling this just to see what breaks (still compiles as of clang 11)
# # be sure to enable (well, disable) the below flags else a *lot* of "errors"
# can try enabling this just to see what breaks (still compiles as of clang 11)
# be sure to enable (well, disable) the below flags else a *lot* of "errors"
-Weverything
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
Expand Down Expand Up @@ -114,7 +114,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
else()
list(APPEND msvc_flags
# /GR- # disable RTTI
/Ob /Oi /Ot /Oy /OX /O2
/Ob /Ot /Oy /OX /O2
/Oi # enable intrinsics
)
endif()
Expand Down Expand Up @@ -174,6 +174,22 @@ function(target_add_common_cflags target scope)
endif()
endfunction()

if (NATIVE)
list(APPEND gcc_flags -march=native -mtune=native)
list(APPEND clang_flags -march=native -mtune=native)
list(APPEND msvc_flags
# x86 flags
/arch:IA32
/arch:SSE
/arch:SSE2

# x86-x64 flags
/arch:AVX
/arch:AVX2
/arch:AVX512
)
endif()

add_subdirectory(core)

if (FRONTEND)
Expand Down
7 changes: 5 additions & 2 deletions src/core/gba.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,13 @@ auto Gba::loadsave(std::span<const u8> new_save) -> bool
std::unreachable();
}

auto Gba::is_save_dirty()-> bool
auto Gba::is_save_dirty(bool auto_clear) -> bool
{
const auto result = this->backup.dirty_ram;
this->backup.dirty_ram = false;
if (auto_clear)
{
this->backup.dirty_ram = false;
}
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/gba.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct Gba
[[nodiscard]] auto loadsave(std::span<const u8> new_save) -> bool;
// checks if the save has been written to.
// the flag is cleared upon calling this function.
[[nodiscard]] auto is_save_dirty()-> bool;
[[nodiscard]] auto is_save_dirty(bool auto_clear) -> bool;
// returns empty span if the game doesn't have a save
// call is_save_dirty() first to see if the game needs saving!
[[nodiscard]] auto getsave() const -> std::span<const u8>;
Expand Down
3 changes: 0 additions & 3 deletions src/frontend/emscripten/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ option(EM_USE_THREADS
option(EMRUN "build with emrun support, used for testing" OFF)

if (EM_USE_THREADS)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
# target_link_options(notorious_beeg_EMSDK PRIVATE "-pthread")
# target_compile_options(notorious_beeg_EMSDK PRIVATE "-pthread")
target_compile_definitions(notorious_beeg_EMSDK PRIVATE EM_THREADS=1)
endif()

Expand Down
Loading

0 comments on commit c4fb449

Please sign in to comment.