Skip to content

Commit

Permalink
Bump 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Waterdish committed Jul 14, 2024
2 parents f64cf9d + e0731a1 commit 17dd587
Show file tree
Hide file tree
Showing 41 changed files with 725 additions and 302 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
if [ ! -d "SDL2-2.28.5" ]; then
wget https://www.libsdl.org/release/SDL2-2.28.5.tar.gz
wget https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-2.28.5.tar.gz
tar -xzf SDL2-2.28.5.tar.gz
fi
cd SDL2-2.28.5
Expand Down Expand Up @@ -261,7 +261,7 @@ jobs:
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
if [ ! -d "SDL2-2.30.3" ]; then
wget https://www.libsdl.org/release/SDL2-2.30.3.tar.gz
wget https://github.com/libsdl-org/SDL/releases/download/release-2.30.3/SDL2-2.30.3.tar.gz
tar -xzf SDL2-2.30.3.tar.gz
fi
cd SDL2-2.30.3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ _packages/

/mm/src/boot/build.c
/mm/windows/properties.h
/clang-format.exe
6 changes: 3 additions & 3 deletions Android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
}
minSdkVersion 24
targetSdkVersion 31
versionCode 2
versionName "1.0.1"
versionCode 3
versionName "1.0.2"
externalNativeBuild {
//ndkBuild {
// arguments "APP_PLATFORM=android-23"
Expand Down Expand Up @@ -79,7 +79,7 @@ dependencies {
}

task wrapper(type: Wrapper) {
gradleVersion = '7.3'
gradleVersion = '7.0.3'
}

task prepareKotlinBuildScriptModel {
Expand Down
4 changes: 2 additions & 2 deletions Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dishii.mm"
android:versionCode="2"
android:versionName="1.0.1"
android:versionCode="3"
android:versionName="1.0.2"
android:installLocation="auto">

<!-- OpenGL ES 3.0 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ private boolean isXboxOneController(UsbDevice usbDevice, UsbInterface usbInterfa
0x044f, // Thrustmaster
0x045e, // Microsoft
0x0738, // Mad Catz
0x0b05, // ASUS
0x0e6f, // PDP
0x0f0d, // Hori
0x10f5, // Turtle Beach
Expand Down Expand Up @@ -590,7 +591,13 @@ public boolean openDevice(int deviceID) {
} else {
flags = 0;
}
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
if (Build.VERSION.SDK_INT >= 33 /* Android 14.0 (U) */) {
Intent intent = new Intent(HIDDeviceManager.ACTION_USB_PERMISSION);
intent.setPackage(mContext.getPackageName());
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, intent, flags));
} else {
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
}
} catch (Exception e) {
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
HIDDeviceOpenResult(deviceID, false);
Expand Down
14 changes: 9 additions & 5 deletions Android/app/src/main/java/org/libsdl/app/SDL.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public static Context getContext() {
}

public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError, SecurityException, NullPointerException {
loadLibrary(libraryName, mContext);
}

public static void loadLibrary(String libraryName, Context context) throws UnsatisfiedLinkError, SecurityException, NullPointerException {

if (libraryName == null) {
throw new NullPointerException("No library name provided.");
Expand All @@ -53,10 +57,10 @@ public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError,
// To use ReLinker, just add it as a dependency. For more information, see
// https://github.com/KeepSafe/ReLinker for ReLinker's repository.
//
Class<?> relinkClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
Class<?> relinkListenerClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
Class<?> contextClass = mContext.getClassLoader().loadClass("android.content.Context");
Class<?> stringClass = mContext.getClassLoader().loadClass("java.lang.String");
Class<?> relinkClass = context.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
Class<?> relinkListenerClass = context.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
Class<?> contextClass = context.getClassLoader().loadClass("android.content.Context");
Class<?> stringClass = context.getClassLoader().loadClass("java.lang.String");

// Get a 'force' instance of the ReLinker, so we can ensure libraries are reinstalled if
// they've changed during updates.
Expand All @@ -66,7 +70,7 @@ public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError,

// Actually load the library!
Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass);
loadMethod.invoke(relinkInstance, mContext, libraryName, null, null);
loadMethod.invoke(relinkInstance, context, libraryName, null, null);
}
catch (final Throwable e) {
// Fall back
Expand Down
12 changes: 6 additions & 6 deletions Android/app/src/main/java/org/libsdl/app/SDLActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 30;
private static final int SDL_MICRO_VERSION = 3;
private static final int SDL_MICRO_VERSION = 5;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
Expand Down Expand Up @@ -281,7 +281,7 @@ protected String[] getLibraries() {
// Load the .so
public void loadLibraries() {
for (String lib : getLibraries()) {
SDL.loadLibrary(lib);
SDL.loadLibrary(lib, this);
}
}

Expand Down Expand Up @@ -995,8 +995,8 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint)
/* No valid hint, nothing is explicitly allowed */
if (!is_portrait_allowed && !is_landscape_allowed) {
if (resizable) {
/* All orientations are allowed */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
/* All orientations are allowed, respecting user orientation lock setting */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
} else {
/* Fixed window and nothing specified. Get orientation from w/h of created window */
req = (w > h ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
Expand All @@ -1005,8 +1005,8 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint)
/* At least one orientation is allowed */
if (resizable) {
if (is_portrait_allowed && is_landscape_allowed) {
/* hint allows both landscape and portrait, promote to full sensor */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
/* hint allows both landscape and portrait, promote to full user */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
} else {
/* Use the only one allowed "orientation" */
req = (is_landscape_allowed ? orientation_landscape : orientation_portrait);
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")

set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")

project(2s2h VERSION 1.0.1 LANGUAGES C CXX)
project(2s2h VERSION 1.0.2 LANGUAGES C CXX)
include(CMake/2ship-cvars.cmake)
include(CMake/lus-cvars.cmake)
set(PROJECT_BUILD_NAME "Rika Bravo" CACHE STRING "")
set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "")
set(PROJECT_BUILD_NAME "Rika Charlie" CACHE STRING "" FORCE)
set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "" FORCE)

set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT 2ship)

Expand Down
Binary file added docs/poweredbylus.darkmode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/poweredbylus.lightmode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docs/supportedHashes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"name": "NTSC-U 1.0",
"sha1": "d6133ace5afaa0882cf214cf88daba39e266c078"
},
{
"name": "NTSC-U GC",
"sha1": "9743aa026e9269b339eb0e3044cd5830a440c1fd"
}
]
2 changes: 1 addition & 1 deletion libultraship
142 changes: 88 additions & 54 deletions mm/2s2h/BenGui/BenMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,24 @@ static const std::unordered_map<int32_t, const char*> alwaysWinDoggyraceOptions
};

namespace BenGui {
std::shared_ptr<std::vector<Ship::WindowBackend>> availableWindowBackends;
std::unordered_map<Ship::WindowBackend, const char*> availableWindowBackendsMap;
Ship::WindowBackend configWindowBackend;

void UpdateWindowBackendObjects() {
Ship::WindowBackend runningWindowBackend = Ship::Context::GetInstance()->GetWindow()->GetWindowBackend();
int32_t configWindowBackendId = Ship::Context::GetInstance()->GetConfig()->GetInt("Window.Backend.Id", -1);
if (configWindowBackendId != -1 && configWindowBackendId < static_cast<int>(Ship::WindowBackend::BACKEND_COUNT)) {
configWindowBackend = static_cast<Ship::WindowBackend>(configWindowBackendId);
} else {
configWindowBackend = runningWindowBackend;
}

availableWindowBackends = Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends();
for (auto& backend : *availableWindowBackends) {
availableWindowBackendsMap[backend] = windowBackendsMap[backend];
}
}

void DrawMenuBarIcon() {
static bool gameIconLoaded = false;
Expand Down Expand Up @@ -247,32 +265,17 @@ void DrawSettingsMenu() {
// UIWidgets::PaddedSeparator(true, true, 3.0f, 3.0f);
// #endregion */

Ship::WindowBackend runningWindowBackend = Ship::Context::GetInstance()->GetWindow()->GetWindowBackend();
Ship::WindowBackend configWindowBackend;
int32_t configWindowBackendId = Ship::Context::GetInstance()->GetConfig()->GetInt("Window.Backend.Id", -1);
if (configWindowBackendId != -1 &&
configWindowBackendId < static_cast<int>(Ship::WindowBackend::BACKEND_COUNT)) {
configWindowBackend = static_cast<Ship::WindowBackend>(configWindowBackendId);
} else {
configWindowBackend = runningWindowBackend;
}

auto availableWindowBackends = Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends();
std::unordered_map<Ship::WindowBackend, const char*> availableWindowBackendsMap;
for (auto& backend : *availableWindowBackends) {
availableWindowBackendsMap[backend] = windowBackendsMap[backend];
}

if (UIWidgets::Combobox(
"Renderer API (Needs reload)", &configWindowBackend, availableWindowBackendsMap,
{ .tooltip = "Sets the renderer API used by the game. Requires a relaunch to take effect.",
.disabled = Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1,
.disabled = availableWindowBackends->size() <= 1,
.disabledTooltip = "Only one renderer API is available on this platform." })) {
Ship::Context::GetInstance()->GetConfig()->SetInt("Window.Backend.Id",
static_cast<int32_t>(configWindowBackend));
Ship::Context::GetInstance()->GetConfig()->SetString("Window.Backend.Name",
windowBackendsMap.at(configWindowBackend));
Ship::Context::GetInstance()->GetConfig()->Save();
UpdateWindowBackendObjects();
}

if (Ship::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) {
Expand Down Expand Up @@ -618,8 +621,32 @@ const char* logLevels[] = {

void DrawDeveloperToolsMenu() {
if (UIWidgets::BeginMenu("Developer Tools", UIWidgets::Colors::Yellow)) {
UIWidgets::CVarCheckbox("Debug Mode", "gDeveloperTools.DebugEnabled",
{ .tooltip = "Enables Debug Mode, allowing you to select maps with L + R + Z." });
if (UIWidgets::CVarCheckbox("Debug Mode", "gDeveloperTools.DebugEnabled",
{ .tooltip = "Enables Debug Mode, revealing some developer options and allows you "
"to enter Map Select with L + R + Z" })) {
// If disabling debug mode, disable all debug features
if (!CVarGetInteger("gDeveloperTools.DebugEnabled", 0)) {
CVarClear("gDeveloperTools.DebugSaveFileMode");
CVarClear("gDeveloperTools.PreventActorUpdate");
CVarClear("gDeveloperTools.PreventActorDraw");
CVarClear("gDeveloperTools.PreventActorInit");
CVarClear("gDeveloperTools.DisableObjectDependency");
if (gPlayState != NULL) {
gPlayState->frameAdvCtx.enabled = false;
}
RegisterDebugSaveCreate();
RegisterPreventActorUpdateHooks();
RegisterPreventActorDrawHooks();
RegisterPreventActorInitHooks();
}
}
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f),
"Warning: Some of these features can break your game,\nor cause unexpected behavior, "
"please ensure you disable them\nbefore reporting any bugs.");
ImGui::EndTooltip();
}

if (CVarGetInteger("gDeveloperTools.DebugEnabled", 0)) {
UIWidgets::CVarCheckbox(
Expand All @@ -632,45 +659,48 @@ void DrawDeveloperToolsMenu() {
"Change the behavior of creating saves while debug mode is enabled:\n\n"
"- Empty Save: The default 3 heart save file in first cycle\n"
"- Vanilla Debug Save: Uses the title screen save info (8 hearts, all items and masks)\n"
"- 100\% Save: All items, equipment, mask, quast status and bombers notebook complete" })) {
"- 100\% Save: All items, equipment, mask, quast status and bombers notebook complete",
.defaultIndex = DEBUG_SAVE_INFO_NONE })) {
RegisterDebugSaveCreate();
}
}

if (UIWidgets::CVarCheckbox("Prevent Actor Update", "gDeveloperTools.PreventActorUpdate")) {
RegisterPreventActorUpdateHooks();
}
if (UIWidgets::CVarCheckbox("Prevent Actor Draw", "gDeveloperTools.PreventActorDraw")) {
RegisterPreventActorDrawHooks();
}
if (UIWidgets::CVarCheckbox("Prevent Actor Init", "gDeveloperTools.PreventActorInit")) {
RegisterPreventActorInitHooks();
}
if (UIWidgets::CVarCombobox("Log Level", "gDeveloperTools.LogLevel", logLevels,
{
.tooltip = "The log level determines which messages are printed to the "
"console. This does not affect the log file output",
.defaultIndex = 1,
})) {
Ship::Context::GetInstance()->GetLogger()->set_level(
(spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", 1));
}
if (UIWidgets::CVarCheckbox("Prevent Actor Update", "gDeveloperTools.PreventActorUpdate")) {
RegisterPreventActorUpdateHooks();
}
if (UIWidgets::CVarCheckbox("Prevent Actor Draw", "gDeveloperTools.PreventActorDraw")) {
RegisterPreventActorDrawHooks();
}
if (UIWidgets::CVarCheckbox("Prevent Actor Init", "gDeveloperTools.PreventActorInit")) {
RegisterPreventActorInitHooks();
}
UIWidgets::CVarCheckbox("Disable Object Dependency", "gDeveloperTools.DisableObjectDependency");

if (UIWidgets::CVarCombobox("Log Level", "gDeveloperTools.LogLevel", logLevels,
{
.tooltip = "The log level determines which messages are printed to the "
"console. This does not affect the log file output",
.defaultIndex = 1,
})) {
Ship::Context::GetInstance()->GetLogger()->set_level(
(spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", 1));
}

if (gPlayState != NULL) {
ImGui::Separator();
UIWidgets::Checkbox(
"Frame Advance", (bool*)&gPlayState->frameAdvCtx.enabled,
{ .tooltip = "This allows you to advance through the game one frame at a time on command. "
"To advance a frame, hold Z and tap R on the second controller. Holding Z "
"and R will advance a frame every half second. You can also use the buttons below." });
if (gPlayState->frameAdvCtx.enabled) {
if (UIWidgets::Button("Advance 1", { .size = UIWidgets::Sizes::Inline })) {
CVarSetInteger("gDeveloperTools.FrameAdvanceTick", 1);
}
ImGui::SameLine();
UIWidgets::Button("Advance (Hold)", { .size = UIWidgets::Sizes::Inline });
if (ImGui::IsItemActive()) {
CVarSetInteger("gDeveloperTools.FrameAdvanceTick", 1);
if (gPlayState != NULL) {
ImGui::Separator();
UIWidgets::Checkbox(
"Frame Advance", (bool*)&gPlayState->frameAdvCtx.enabled,
{ .tooltip = "This allows you to advance through the game one frame at a time on command. "
"To advance a frame, hold Z and tap R on the second controller. Holding Z "
"and R will advance a frame every half second. You can also use the buttons below." });
if (gPlayState->frameAdvCtx.enabled) {
if (UIWidgets::Button("Advance 1", { .size = UIWidgets::Sizes::Inline })) {
CVarSetInteger("gDeveloperTools.FrameAdvanceTick", 1);
}
ImGui::SameLine();
UIWidgets::Button("Advance (Hold)", { .size = UIWidgets::Sizes::Inline });
if (ImGui::IsItemActive()) {
CVarSetInteger("gDeveloperTools.FrameAdvanceTick", 1);
}
}
}
}
Expand Down Expand Up @@ -714,6 +744,10 @@ void DrawDeveloperToolsMenu() {
}
}

void BenMenuBar::InitElement() {
UpdateWindowBackendObjects();
}

void BenMenuBar::DrawElement() {
if (ImGui::BeginMenuBar()) {
DrawMenuBarIcon();
Expand Down
2 changes: 1 addition & 1 deletion mm/2s2h/BenGui/BenMenuBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BenMenuBar : public Ship::GuiMenuBar {

protected:
void DrawElement() override;
void InitElement() override{};
void InitElement() override;
void UpdateElement() override{};
};
} // namespace BenGui
Expand Down
Loading

0 comments on commit 17dd587

Please sign in to comment.