mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-25 07:58:04 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22c6b8e963 | ||
|
|
576afecbfc | ||
|
|
4e28d92a2d | ||
|
|
22192c245f | ||
|
|
409fa83406 | ||
|
|
894b0592f4 | ||
|
|
370100a6f2 | ||
|
|
18cfbc90f2 | ||
|
|
cd51dc7f02 | ||
|
|
e2638ed840 | ||
|
|
6607815df3 | ||
|
|
77ed85aff7 | ||
|
|
3b1a311f32 | ||
|
|
1b3c2190b8 | ||
|
|
52e2d6095a | ||
|
|
47e2fcaec0 | ||
|
|
183ceb614a | ||
|
|
185e62010b | ||
|
|
6f647701dd | ||
|
|
a9c79b2e31 | ||
|
|
ba52fbf5e9 | ||
|
|
85d40701c4 | ||
|
|
7b535b371a | ||
|
|
c0dbae8202 | ||
|
|
ca03450b87 | ||
|
|
f795a500cf | ||
|
|
3314f00bf8 | ||
|
|
a2d79f045c | ||
|
|
f247495578 | ||
|
|
f6583330de | ||
|
|
4b15f45897 | ||
|
|
7bc433731f | ||
|
|
4c21570eb1 | ||
|
|
a3e7feffc2 | ||
|
|
a4c1dd1acf | ||
|
|
09086ccc85 | ||
|
|
53e39b7c11 | ||
|
|
f0ccfee40f | ||
|
|
10cdec98e6 | ||
|
|
c61afb4308 | ||
|
|
f6cf881e61 | ||
|
|
a8277e71a7 | ||
|
|
3482fb6440 | ||
|
|
3c81c8fec2 | ||
|
|
e090485b37 |
@@ -15,7 +15,7 @@ jobs:
|
||||
run: |
|
||||
cd android
|
||||
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > keystore.jks
|
||||
ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle ./gradlew assembleRelease
|
||||
JAVA_HOME=$JAVA_HOME_17_X64 ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle ./gradlew assembleRelease
|
||||
env:
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Emscripten Build
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
EM_VERSION: 3.1.34
|
||||
EM_VERSION: 3.1.50
|
||||
EM_CACHE_FOLDER: 'emsdk-cache'
|
||||
|
||||
jobs:
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
key: ${{env.EM_VERSION}}-${{ runner.os }}
|
||||
|
||||
- name: Setup Emscripten toolchain
|
||||
uses: mymindstorm/setup-emsdk@v12
|
||||
uses: mymindstorm/setup-emsdk@v13
|
||||
with:
|
||||
version: ${{ env.EM_VERSION }}
|
||||
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
|
||||
|
||||
@@ -5,10 +5,17 @@ jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { sys: MINGW32, installer: "xsystem35-32bit" }
|
||||
- { sys: MINGW64, installer: "xsystem35-64bit" }
|
||||
- sys: mingw32
|
||||
package: "xsystem35-32bit"
|
||||
cmake_args: "-DENABLE_DEBUGGER=no"
|
||||
deps: ""
|
||||
- sys: ucrt64
|
||||
package: "xsystem35-64bit"
|
||||
cmake_args: ""
|
||||
deps: "cjson:p"
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
@@ -19,27 +26,30 @@ jobs:
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: ${{ matrix.sys }}
|
||||
update: true
|
||||
pacboy: >-
|
||||
gcc:p
|
||||
cmake:p
|
||||
ninja:p
|
||||
SDL2:p
|
||||
SDL2_ttf:p
|
||||
SDL2_mixer:p
|
||||
libwebp:p
|
||||
cjson:p
|
||||
nsis:p
|
||||
ntldd-git:p
|
||||
${{ matrix.deps }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Copy licenses
|
||||
run: |
|
||||
ls /${{ matrix.sys }}/share/licenses
|
||||
mkdir dist
|
||||
cp -r /${{ matrix.sys }}/share/licenses dist/
|
||||
|
||||
- name: Install dev dependencies
|
||||
run: pacboy --noconfirm -S --needed gcc:p cmake:p ninja:p
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p out/release
|
||||
cd out/release
|
||||
cmake -G"Ninja" -DCMAKE_BUILD_TYPE=Release ../../
|
||||
cmake -G"Ninja" -DCMAKE_BUILD_TYPE=Release ${{ matrix.cmake_args }} ../../
|
||||
ninja
|
||||
|
||||
- name: Test
|
||||
@@ -47,11 +57,11 @@ jobs:
|
||||
working-directory: out/release
|
||||
|
||||
- name: Package
|
||||
working-directory: tools/installer
|
||||
run: ./make-installer.sh ../../out/release ${{ matrix.installer }}.nsi
|
||||
run: |
|
||||
cp out/release/src/xsystem35.exe *.md COPYING xsys35rc.sample dist/
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.installer }}
|
||||
path: tools/installer/${{ matrix.installer }}.exe
|
||||
name: ${{ matrix.package }}
|
||||
path: dist
|
||||
|
||||
+65
-16
@@ -4,16 +4,8 @@ project(xsystem35 LANGUAGES C)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
enable_testing()
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CheckLibraryExists)
|
||||
include(CheckSymbolExists)
|
||||
|
||||
# In msys, `pkg-config --libs` returns `-lmingw32` but find_library() cannot
|
||||
# find it in default search paths.
|
||||
if (MSYS)
|
||||
list(APPEND CMAKE_LIBRARY_PATH $ENV{MINGW_PREFIX}/$ENV{MINGW_CHOST}/lib)
|
||||
endif ()
|
||||
|
||||
# A wrapper around pkg_check_modules() that skips the check if ENABLE_<prefix> is false
|
||||
macro (optional_pkg_check_modules prefix)
|
||||
option(ENABLE_${prefix} "Use ${prefix} if available" ON)
|
||||
@@ -22,19 +14,49 @@ macro (optional_pkg_check_modules prefix)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Generates a static library from pkg_check_modules() result
|
||||
function(add_static_library name pkg)
|
||||
add_library(${name} INTERFACE)
|
||||
set_target_properties(${name}
|
||||
PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${${pkg}_STATIC_INCLUDE_DIRS}"
|
||||
INTERFACE_COMPILE_OPTIONS "${${pkg}_STATIC_CFLAGS_OTHER}"
|
||||
INTERFACE_LINK_LIBRARIES "${${pkg}_STATIC_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${${pkg}_STATIC_LDFLAGS_OTHER}")
|
||||
endfunction()
|
||||
|
||||
check_symbol_exists(getlogin "unistd.h" HAVE_GETLOGIN)
|
||||
check_symbol_exists(mmap "sys/mman.h" HAVE_MMAP)
|
||||
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
|
||||
check_symbol_exists(uname "sys/utsname.h" HAVE_UNAME)
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
function(add_emscripten_library name option)
|
||||
add_library(${name} INTERFACE)
|
||||
set_target_properties(${name} PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS ${option}
|
||||
INTERFACE_LINK_OPTIONS ${option})
|
||||
endfunction()
|
||||
add_emscripten_library(zlib "SHELL:-s USE_ZLIB=1")
|
||||
add_emscripten_library(sdl2 "SHELL:-s USE_SDL=2")
|
||||
add_emscripten_library(sdl2_ttf "SHELL:-s USE_SDL_TTF=2")
|
||||
set(DEFAULT_FONT_PATH /fonts/)
|
||||
|
||||
elseif (ANDROID)
|
||||
add_library(sdl2 ALIAS SDL2)
|
||||
add_library(sdl2_ttf ALIAS SDL2_ttf)
|
||||
add_library(sdl2_mixer ALIAS SDL2_mixer)
|
||||
set(SDL2MIXER_FOUND 1)
|
||||
find_library(ndk_zlib z)
|
||||
find_library(ndk_log log)
|
||||
else()
|
||||
find_library(ndk_zlib z)
|
||||
add_library(zlib INTERFACE)
|
||||
set_target_properties(zlib PROPERTIES INTERFACE_LINK_LIBRARIES ${ndk_zlib})
|
||||
|
||||
else() # non-emscripten, non-android
|
||||
if (WIN32)
|
||||
set(ZLIB_USE_STATIC_LIBS ON)
|
||||
endif()
|
||||
find_package(ZLIB REQUIRED)
|
||||
add_library(zlib ALIAS ZLIB::ZLIB)
|
||||
|
||||
include(FindPkgConfig)
|
||||
optional_pkg_check_modules(GTK3 IMPORTED_TARGET gtk+-3.0)
|
||||
@@ -42,25 +64,54 @@ else()
|
||||
set(ENABLE_GTK 1)
|
||||
endif()
|
||||
|
||||
pkg_check_modules(SDL2 IMPORTED_TARGET sdl2)
|
||||
pkg_check_modules(SDL2TTF IMPORTED_TARGET SDL2_ttf)
|
||||
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2)
|
||||
pkg_check_modules(SDL2TTF REQUIRED IMPORTED_TARGET SDL2_ttf)
|
||||
optional_pkg_check_modules(SDL2MIXER IMPORTED_TARGET SDL2_mixer)
|
||||
if (WIN32)
|
||||
add_static_library(sdl2 SDL2)
|
||||
add_static_library(sdl2_ttf SDL2TTF)
|
||||
# Workaround for linking error
|
||||
set_property(TARGET sdl2_ttf PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
$<LINK_GROUP:RESCAN,${SDL2TTF_STATIC_LIBRARIES} -lstdc++>)
|
||||
if (SDL2MIXER_FOUND)
|
||||
add_static_library(sdl2_mixer SDL2MIXER)
|
||||
endif()
|
||||
else()
|
||||
add_library(sdl2 ALIAS PkgConfig::SDL2)
|
||||
add_library(sdl2_ttf ALIAS PkgConfig::SDL2TTF)
|
||||
if (SDL2MIXER_FOUND)
|
||||
add_library(sdl2_mixer ALIAS PkgConfig::SDL2MIXER)
|
||||
endif()
|
||||
set(DEFAULT_FONT_PATH ${CMAKE_INSTALL_PREFIX}/share/xsystem35/fonts/)
|
||||
endif()
|
||||
|
||||
option(ENABLE_DEBUGGER "Enable built-in debugger" ON)
|
||||
if (ENABLE_DEBUGGER)
|
||||
pkg_check_modules(cJSON IMPORTED_TARGET libcjson)
|
||||
if (NOT cJSON_FOUND)
|
||||
if (cJSON_FOUND)
|
||||
if (WIN32)
|
||||
add_static_library(cJSON cJSON)
|
||||
else ()
|
||||
add_library(cJSON ALIAS PkgConfig::cJSON)
|
||||
endif()
|
||||
else ()
|
||||
# libcjson-dev of Debian buster / Ubuntu 20.04 does not install pkgconfig files.
|
||||
find_library(cJSON cjson)
|
||||
if (NOT cJSON)
|
||||
message(FATAL_ERROR "libcjson is required but not found.")
|
||||
endif()
|
||||
add_library(cJSON ALIAS ${cJSON})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
optional_pkg_check_modules(WEBP IMPORTED_TARGET libwebp)
|
||||
if (WEBP_FOUND)
|
||||
set(HAVE_WEBP 1)
|
||||
if (WIN32)
|
||||
add_static_library(WebP WEBP)
|
||||
else()
|
||||
add_library(WebP ALIAS PkgConfig::WEBP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_library(PORTMIDI portmidi)
|
||||
@@ -68,8 +119,6 @@ else()
|
||||
set(HAVE_PORTMIDI 1)
|
||||
set(ENABLE_MIDI_PORTMIDI 1)
|
||||
endif()
|
||||
|
||||
set(DEFAULT_FONT_PATH ${CMAKE_INSTALL_PREFIX}/share/xsystem35/fonts/)
|
||||
endif()
|
||||
|
||||
# Menu
|
||||
|
||||
@@ -3,22 +3,22 @@
|
||||
This is a multi-platform port of `xsystem35`, a free implementation of
|
||||
AliceSoft's System 3.x game engine.
|
||||
|
||||
## Compatiblity
|
||||
## Compatibility
|
||||
|
||||
See the [game compatibility table](game_compatibility.md) for a list of games
|
||||
that can be played on xsystem35-sdl2.
|
||||
that can be played with xsystem35-sdl2.
|
||||
|
||||
## Unique Features
|
||||
|
||||
In addition to the original System 3.x's functionalities, xsystem35-sdl2 has
|
||||
the following features.
|
||||
In addition to the original System 3.x functionalities, xsystem35-sdl2 offers
|
||||
the following features:
|
||||
|
||||
### Playing audio files as fake CD music
|
||||
### Playing Audio Files as Virtual CD Music
|
||||
|
||||
Many System 3.x games had music as audio tracks on the CD-ROM. Xsystem35 can
|
||||
play music from audio files instead, to avoid the hassle of inserting CDs. To
|
||||
use ripped audio files, create a file named `playlist.txt` in the game
|
||||
directory, and enter the paths to your tracks, one per line. For example:
|
||||
Many System 3.x games feature music as audio tracks on the CD-ROM. xsystem35
|
||||
can play music from audio files, eliminating the need to insert CDs. To use
|
||||
ripped audio files, create a file named `playlist.txt` in the game directory
|
||||
and list the paths to your tracks, one per line. For example:
|
||||
|
||||
```
|
||||
# The first line is not used
|
||||
@@ -27,89 +27,108 @@ BGM/track03.mp3
|
||||
...
|
||||
```
|
||||
|
||||
The first line is not used, because track 1 of game CD is usually a data track.
|
||||
The first line is not used because the first track on a game CD is typically a
|
||||
data track.
|
||||
|
||||
### Unicode translation support
|
||||
Some games have integrated music as MIDI. In such cases, the music won't play
|
||||
using the virtual CD feature. If you encounter a `Cannot load MIDI` error
|
||||
message, you might need to set the `SDL_SOUNDFONTS` environment variable to
|
||||
point to an `.sf2` file. For example:
|
||||
|
||||
The original System 3.x only supported Shift_JIS (a Japanese character
|
||||
encoding), but xsystem35 supports Unicode and is able to run games translated
|
||||
into languages other than Japanese and English.
|
||||
```
|
||||
SDL_SOUNDFONTS=/usr/share/soundfonts/GeneralUser.sf2 xsystem35
|
||||
```
|
||||
|
||||
See [xsys35c](https://github.com/kichikuou/xsys35c)'s document for how to
|
||||
build a game with Unicode mode.
|
||||
### Unicode Translation Support
|
||||
|
||||
While the original System 3.x only supported Shift_JIS (a Japanese character
|
||||
encoding), xsystem35 supports Unicode and can run games translated into
|
||||
languages other than Japanese and English.
|
||||
|
||||
For instructions on how to build a game with Unicode support, see the
|
||||
[xsys35c](https://github.com/kichikuou/xsys35c) documentation.
|
||||
|
||||
### Debugging
|
||||
|
||||
Xsystem35 has a built-in debugger that allows you to step through the game and
|
||||
examine / modify variables in the game. There are two ways to use the debugger:
|
||||
xsystem35 features a built-in debugger that allows you to step through the game
|
||||
and examine or modify game variables. There are two ways to use the debugger:
|
||||
|
||||
- Through [Visual Studio Code](https://code.visualstudio.com/) (recommended):
|
||||
The [vscode-system3x](https://github.com/kichikuou/vscode-system3x) extension
|
||||
provides graphical debugging interface for System 3.x.
|
||||
- Using CUI debugger: Running xsystem35 with `-debug` option will start the
|
||||
debugger with console interface. Type `help` to see a list of available
|
||||
commands.
|
||||
provides a graphical debugging interface for System 3.x.
|
||||
- Using the CLI Debugger: Running xsystem35 with the `-debug` option will
|
||||
launch the debugger with a console interface. Type `help` to see a list of
|
||||
available commands.
|
||||
|
||||
## Installing
|
||||
## Installation
|
||||
|
||||
Prebuilt packages for Windows and Android can be downloaded from the
|
||||
[Releases](https://github.com/kichikuou/xsystem35-sdl2/releases) page. For
|
||||
other platforms, see the [Building](#building) section.
|
||||
other platforms, refer to the [Building](#building) section.
|
||||
|
||||
## Running
|
||||
### Windows
|
||||
|
||||
Execute `xsytem35`, and it will show a dialog to select a folder. Select the
|
||||
game folder (where the ALD files are located).
|
||||
Copy `xsystem35.exe` to the game folder and run it.
|
||||
|
||||
### Android
|
||||
|
||||
See [android/README.md](https://github.com/kichikuou/xsystem35-sdl2/blob/master/android/README.md#use).
|
||||
See [android/README.md](android/README.md#use).
|
||||
|
||||
### Other Platforms
|
||||
|
||||
Run xsystem35 from within the game directory.
|
||||
|
||||
cd /path/to/game_directory
|
||||
xsystem35
|
||||
```bash
|
||||
$ cd /path/to/game_directory
|
||||
$ xsystem35
|
||||
```
|
||||
|
||||
## Building
|
||||
### Linux (Debian / Ubuntu)
|
||||
|
||||
$ sudo apt install build-essential cmake libgtk-3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libwebp-dev libcjson-dev
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
$ make && make install
|
||||
```bash
|
||||
$ sudo apt install build-essential cmake libgtk-3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libwebp-dev libcjson-dev
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
$ make && make install
|
||||
```
|
||||
|
||||
### MacOS
|
||||
|
||||
[Homebrew](https://brew.sh/index_ja) is needed.
|
||||
[Homebrew](https://brew.sh/) is required.
|
||||
|
||||
$ brew install cmake pkg-config sdl2 sdl2_mixer sdl2_ttf webp cjson
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
$ make && make install
|
||||
```bash
|
||||
$ brew install cmake pkg-config sdl2 sdl2_mixer sdl2_ttf webp cjson
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
$ make && make install
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
[MSYS2](https://www.msys2.org) is needed.
|
||||
[MSYS2](https://www.msys2.org) is required.
|
||||
|
||||
$ pacman -S cmake mingw-w64-x86_64-cmake mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_ttf mingw-w64-x86_64-SDL2_mixer mingw-w64-x86_64-libwebp mingw-w64-x86_64-cjson
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
$ make
|
||||
```bash
|
||||
$ pacman -S cmake mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-SDL2 mingw-w64-ucrt-x86_64-SDL2_ttf mingw-w64-ucrt-x86_64-SDL2_mixer mingw-w64-ucrt-x86_64-libwebp mingw-w64-ucrt-x86_64-cjson
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
$ make
|
||||
```
|
||||
|
||||
### Emscripten
|
||||
|
||||
$ mkdir -p out/wasm
|
||||
$ cd out/wasm
|
||||
$ emcmake cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../../
|
||||
$ make
|
||||
```bash
|
||||
$ mkdir -p out/wasm
|
||||
$ cd out/wasm
|
||||
$ emcmake cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../../
|
||||
$ make
|
||||
```
|
||||
|
||||
To use the generated binary, checkout
|
||||
To use the generated binary, check out
|
||||
[Kichikuou on Web](https://github.com/kichikuou/web) and copy `out/xsystem35.*`
|
||||
into its `docs` directory.
|
||||
|
||||
|
||||
+34
-20
@@ -1,7 +1,8 @@
|
||||
# xsystem35 for Android
|
||||
|
||||
## Download
|
||||
Prebuilt APKs are [here](https://github.com/kichikuou/xsystem35-sdl2/releases).
|
||||
You can download prebuilt APKs
|
||||
[here](https://github.com/kichikuou/xsystem35-sdl2/releases).
|
||||
|
||||
## Build
|
||||
Prerequisites:
|
||||
@@ -11,10 +12,10 @@ Prerequisites:
|
||||
### Using Android Studio
|
||||
Open this directory as an Android Studio project.
|
||||
|
||||
### Command line build
|
||||
Configure environment variables and run the `gradlew` script in this folder.
|
||||
### Command Line Build
|
||||
Set environment variables and run the `gradlew` script in this directory.
|
||||
|
||||
Example build instructions (for Debian bullseye):
|
||||
Example build instructions (for Debian bookworm):
|
||||
```sh
|
||||
# Install necessary packages
|
||||
sudo apt install git wget unzip default-jdk-headless ninja-build
|
||||
@@ -22,38 +23,51 @@ sudo apt install git wget unzip default-jdk-headless ninja-build
|
||||
# Install Android SDK / NDK
|
||||
export ANDROID_SDK_ROOT=$HOME/android-sdk
|
||||
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools
|
||||
wget https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip
|
||||
unzip commandlinetools-linux-8512546_latest.zip -d $ANDROID_SDK_ROOT/cmdline-tools
|
||||
wget https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip
|
||||
unzip commandlinetools-linux-10406996_latest.zip -d $ANDROID_SDK_ROOT/cmdline-tools
|
||||
mv $ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools $ANDROID_SDK_ROOT/cmdline-tools/tools
|
||||
yes |$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager --licenses
|
||||
yes | $ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager --licenses
|
||||
$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager ndk-bundle 'cmake;3.22.1'
|
||||
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle
|
||||
|
||||
# Check out and build xsystem35
|
||||
# Clone and build xsystem35
|
||||
git clone https://github.com/kichikuou/xsystem35-sdl2.git
|
||||
cd xsystem35-sdl2/android
|
||||
./gradlew build # or ./gradlew installDebug if you have a connected device
|
||||
```
|
||||
|
||||
## Use
|
||||
## Usage
|
||||
### Basic Usage
|
||||
1. Create a ZIP file containing all the game files and BGM files (see [below](#preparing-a-zip) for details), and transfer it to your device.
|
||||
2. Open the app. A list of installed games is displayed. Since nothing has been installed yet, only the "Install from ZIP" button is displayed. Tap it.
|
||||
3. Select the ZIP file you created in 1.
|
||||
4. The game starts. To simulate right-click, tap the black bars on the left/right or top/bottom of the screen.
|
||||
1. Create a ZIP file containing all the game files and BGM files (see
|
||||
[below](#preparing-a-zip) for details), and transfer it to your device.
|
||||
2. Open the app. A list of installed games will be displayed. Since no games
|
||||
have been installed yet, only the "Install from ZIP" button will be visible.
|
||||
Tap it.
|
||||
3. Select the ZIP file you created in step 1.
|
||||
4. The game will start. To simulate a right-click, tap the black bars on either
|
||||
the left or right, or top or bottom of the screen.
|
||||
|
||||
### Preparing a ZIP
|
||||
- Include all files in the `GAMEDATA` folder (`.ALD` files and others). `.EXE` and `.DLL` are not really needed, but you can include them as well.
|
||||
- Music files (`.mp3`, `.ogg` or `.wav`) whose file names end with a number are recognized as BGM files. For example:
|
||||
- Include all files from the `GAMEDATA` folder (such as `.ALD` files and
|
||||
others). `.EXE` and `.DLL` files are not necessary, but you can include them
|
||||
if you want.
|
||||
- Music files (`.mp3`, `.ogg`, or `.wav`) whose filenames end with a number
|
||||
will be recognized as BGM files. For example:
|
||||
- `Track2.mp3`
|
||||
- `15.ogg`
|
||||
- `rance4_03.wav` (This shouldn't be `rance403.wav`, because it would be treated as the 403rd track)
|
||||
- `rance4_03.wav` (Note: The filename shouldn't be `rance403.wav`, as it
|
||||
would be treated as the 403rd track.)
|
||||
|
||||
Note: This form of ZIP can be used in [Kichikuou on Web](http://kichikuou.github.io/web/) as well.
|
||||
Note: This ZIP format is also compatible with
|
||||
[Kichikuou on Web](http://kichikuou.github.io/web/).
|
||||
|
||||
### Miscellaneous
|
||||
- You can export / import saved files using the option menu of the game list.
|
||||
- To uninstall a game, long-tap the title in the game list.
|
||||
- You can export or import save files via the game list's option menu.
|
||||
- To uninstall a game, long-tap its title in the game list.
|
||||
|
||||
## Known Issues
|
||||
- Android versions older than 7.0 cannot handle ZIPs containing Shift-JIS file names. This is the case with some ZIPs distributed on [retroc.net](http://retropc.net/alice/). If you get the error "This type of ZIP is not supported.", unzip the ZIP file on your PC and re-archive it with a modern ZIP creation software.
|
||||
- Android versions older than 7.0 cannot handle ZIP files containing Shift-JIS
|
||||
filenames. This issue occurs with some ZIP files distributed on
|
||||
[retroc.net](http://retropc.net/alice/). If you encounter the error message
|
||||
"This type of ZIP is not supported," unzip the file on your PC and re-archive
|
||||
it using modern ZIP creation software.
|
||||
|
||||
+13
-11
@@ -9,18 +9,18 @@ else {
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 31
|
||||
if (buildAsApplication) {
|
||||
namespace "io.github.kichikuou.xsystem35"
|
||||
}
|
||||
compileSdkVersion 34
|
||||
defaultConfig {
|
||||
if (buildAsApplication) {
|
||||
applicationId "io.github.kichikuou.xsystem35"
|
||||
}
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 31
|
||||
versionCode 15
|
||||
versionName "2.9.1" + gitRevision()
|
||||
targetSdkVersion 34
|
||||
versionCode 18
|
||||
versionName "2.11.0" + gitRevision()
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
|
||||
arguments "-DANDROID_APP_PLATFORM=android-19", "-DANDROID_STL=c++_static"
|
||||
// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a'
|
||||
}
|
||||
@@ -38,7 +38,9 @@ android {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.release
|
||||
if (rootProject.file('keystore.jks').exists()) {
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
}
|
||||
applicationVariants.all { variant ->
|
||||
@@ -62,10 +64,10 @@ android {
|
||||
}
|
||||
|
||||
}
|
||||
lintOptions {
|
||||
lint {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
|
||||
if (buildAsLibrary) {
|
||||
libraryVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
project(GAME)
|
||||
set(PROJECT_ROOT_DIR ../../..)
|
||||
|
||||
# Compilation of SDL and companion libraries
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
SDL
|
||||
URL https://github.com/libsdl-org/SDL/releases/download/release-2.26.1/SDL2-2.26.1.tar.gz
|
||||
URL_HASH SHA1=08a8cec21ffcebf44e4633a786d594a7811100d2
|
||||
URL https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-2.28.5.tar.gz
|
||||
URL_HASH SHA1=50af6b564890d702e57e2a72d6429b43778ed29a
|
||||
)
|
||||
FetchContent_Declare(
|
||||
SDL_ttf
|
||||
@@ -20,31 +21,20 @@ FetchContent_Declare(
|
||||
URL_HASH SHA1=036fc7839a6b8dc1af3dbfed4e2531224bbacdd7
|
||||
)
|
||||
|
||||
# Compilation of SDL and companion libraries
|
||||
FetchContent_GetProperties(SDL)
|
||||
if(NOT sdl_POPULATED)
|
||||
FetchContent_Populate(SDL)
|
||||
add_subdirectory(${sdl_SOURCE_DIR} ${sdl_BINARY_DIR})
|
||||
endif()
|
||||
FetchContent_GetProperties(SDL_ttf)
|
||||
if(NOT sdl_ttf_POPULATED)
|
||||
FetchContent_Populate(SDL_ttf)
|
||||
set(SDL2TTF_SAMPLES OFF CACHE BOOL "Build the SDL2_ttf sample program(s)" FORCE)
|
||||
set(SDL2TTF_INSTALL OFF CACHE BOOL "Enable SDL2_ttf install target" FORCE)
|
||||
set(SDL2TTF_VENDORED ON CACHE BOOL "Use vendored third-party libraries" FORCE)
|
||||
add_subdirectory(${sdl_ttf_SOURCE_DIR} ${sdl_ttf_BINARY_DIR})
|
||||
endif()
|
||||
FetchContent_GetProperties(SDL_mixer)
|
||||
if(NOT sdl_mixer_POPULATED)
|
||||
FetchContent_Populate(SDL_mixer)
|
||||
set(SDL2MIXER_OPUS OFF CACHE BOOL "Enable Opus music" FORCE)
|
||||
set(SDL2MIXER_FLAC OFF CACHE BOOL "Enable FLAC music" FORCE)
|
||||
set(SDL2MIXER_MOD OFF CACHE BOOL "Support loading MOD music" FORCE)
|
||||
set(SDL2MIXER_MIDI OFF CACHE BOOL "Enable MIDI music" FORCE)
|
||||
set(SDL2MIXER_SAMPLES OFF CACHE BOOL "Build the SDL2_mixer sample program(s)" FORCE)
|
||||
set(SDL2MIXER_INSTALL OFF CACHE BOOL "Enable SDL2_mixer install target" FORCE)
|
||||
add_subdirectory(${sdl_mixer_SOURCE_DIR} ${sdl_mixer_BINARY_DIR})
|
||||
endif()
|
||||
set(SDL2TTF_SAMPLES OFF CACHE BOOL "Build the SDL2_ttf sample program(s)" FORCE)
|
||||
set(SDL2TTF_INSTALL OFF CACHE BOOL "Enable SDL2_ttf install target" FORCE)
|
||||
set(SDL2TTF_VENDORED ON CACHE BOOL "Use vendored third-party libraries" FORCE)
|
||||
|
||||
set(SDL2MIXER_OPUS OFF CACHE BOOL "Enable Opus music" FORCE)
|
||||
set(SDL2MIXER_FLAC OFF CACHE BOOL "Enable FLAC music" FORCE)
|
||||
set(SDL2MIXER_MOD OFF CACHE BOOL "Support loading MOD music" FORCE)
|
||||
set(SDL2MIXER_MIDI OFF CACHE BOOL "Enable MIDI music" FORCE)
|
||||
set(SDL2MIXER_SAMPLES OFF CACHE BOOL "Build the SDL2_mixer sample program(s)" FORCE)
|
||||
set(SDL2MIXER_INSTALL OFF CACHE BOOL "Enable SDL2_mixer install target" FORCE)
|
||||
|
||||
FetchContent_MakeAvailable(SDL)
|
||||
FetchContent_MakeAvailable(SDL_ttf)
|
||||
FetchContent_MakeAvailable(SDL_mixer)
|
||||
|
||||
# The main CMakeLists.txt of xsystem35
|
||||
add_subdirectory(${PROJECT_ROOT_DIR} xsystem35)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="io.github.kichikuou.xsystem35"
|
||||
android:installLocation="auto">
|
||||
|
||||
<!-- OpenGL ES 2.0 -->
|
||||
|
||||
@@ -186,7 +186,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
||||
// Because on Chromebooks we show up as a dual-mode device, it will attempt to connect TRANSPORT_AUTO, which will use TRANSPORT_BREDR instead
|
||||
// of TRANSPORT_LE. Let's force ourselves to connect low energy.
|
||||
private BluetoothGatt connectGatt(boolean managed) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
if (Build.VERSION.SDK_INT >= 23 /* Android 6.0 (M) */) {
|
||||
try {
|
||||
return mDevice.connectGatt(mManager.getContext(), managed, this, TRANSPORT_LE);
|
||||
} catch (Exception e) {
|
||||
@@ -429,7 +429,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (newState == 0) {
|
||||
mIsConnected = false;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public class HIDDeviceManager {
|
||||
Log.i(TAG," Interface protocol: " + mUsbInterface.getInterfaceProtocol());
|
||||
Log.i(TAG," Endpoint count: " + mUsbInterface.getEndpointCount());
|
||||
|
||||
// Get endpoint details
|
||||
// Get endpoint details
|
||||
for (int epi = 0; epi < mUsbInterface.getEndpointCount(); epi++)
|
||||
{
|
||||
UsbEndpoint mEndpoint = mUsbInterface.getEndpoint(epi);
|
||||
@@ -251,6 +251,8 @@ public class HIDDeviceManager {
|
||||
0x20d6, // PowerA
|
||||
0x24c6, // PowerA
|
||||
0x2c22, // Qanba
|
||||
0x2dc8, // 8BitDo
|
||||
0x9886, // ASTRO Gaming
|
||||
};
|
||||
|
||||
if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
|
||||
@@ -271,14 +273,17 @@ public class HIDDeviceManager {
|
||||
final int XB1_IFACE_SUBCLASS = 71;
|
||||
final int XB1_IFACE_PROTOCOL = 208;
|
||||
final int[] SUPPORTED_VENDORS = {
|
||||
0x03f0, // HP
|
||||
0x044f, // Thrustmaster
|
||||
0x045e, // Microsoft
|
||||
0x0738, // Mad Catz
|
||||
0x0e6f, // PDP
|
||||
0x0f0d, // Hori
|
||||
0x10f5, // Turtle Beach
|
||||
0x1532, // Razer Wildcat
|
||||
0x20d6, // PowerA
|
||||
0x24c6, // PowerA
|
||||
0x2dc8, /* 8BitDo */
|
||||
0x2dc8, // 8BitDo
|
||||
0x2e24, // Hyperkin
|
||||
};
|
||||
|
||||
@@ -353,13 +358,13 @@ public class HIDDeviceManager {
|
||||
private void initializeBluetooth() {
|
||||
Log.d(TAG, "Initializing Bluetooth");
|
||||
|
||||
if (Build.VERSION.SDK_INT <= 30 &&
|
||||
if (Build.VERSION.SDK_INT <= 30 /* Android 11.0 (R) */ &&
|
||||
mContext.getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH, mContext.getPackageName()) != PackageManager.PERMISSION_GRANTED) {
|
||||
Log.d(TAG, "Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18)) {
|
||||
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18 /* Android 4.3 (JELLY_BEAN_MR2) */)) {
|
||||
Log.d(TAG, "Couldn't initialize Bluetooth, this version of Android does not support Bluetooth LE");
|
||||
return;
|
||||
}
|
||||
@@ -524,7 +529,7 @@ public class HIDDeviceManager {
|
||||
for (HIDDevice device : mDevicesById.values()) {
|
||||
device.setFrozen(frozen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -573,7 +578,7 @@ public class HIDDeviceManager {
|
||||
try {
|
||||
final int FLAG_MUTABLE = 0x02000000; // PendingIntent.FLAG_MUTABLE, but don't require SDK 31
|
||||
int flags;
|
||||
if (Build.VERSION.SDK_INT >= 31) {
|
||||
if (Build.VERSION.SDK_INT >= 31 /* Android 12.0 (S) */) {
|
||||
flags = FLAG_MUTABLE;
|
||||
} else {
|
||||
flags = 0;
|
||||
|
||||
@@ -52,7 +52,7 @@ class HIDDeviceUSB implements HIDDevice {
|
||||
@Override
|
||||
public String getSerialNumber() {
|
||||
String result = null;
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
|
||||
try {
|
||||
result = mDevice.getSerialNumber();
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class HIDDeviceUSB implements HIDDevice {
|
||||
@Override
|
||||
public String getManufacturerName() {
|
||||
String result = null;
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
|
||||
result = mDevice.getManufacturerName();
|
||||
}
|
||||
if (result == null) {
|
||||
@@ -86,7 +86,7 @@ class HIDDeviceUSB implements HIDDevice {
|
||||
@Override
|
||||
public String getProductName() {
|
||||
String result = null;
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
|
||||
result = mDevice.getProductName();
|
||||
}
|
||||
if (result == null) {
|
||||
|
||||
@@ -29,6 +29,7 @@ public class SDL {
|
||||
|
||||
// This function stores the current activity (SDL or not)
|
||||
public static void setContext(Context context) {
|
||||
SDLAudioManager.setContext(context);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ import java.util.Locale;
|
||||
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
|
||||
private static final String TAG = "SDL";
|
||||
private static final int SDL_MAJOR_VERSION = 2;
|
||||
private static final int SDL_MINOR_VERSION = 26;
|
||||
private static final int SDL_MICRO_VERSION = 1;
|
||||
private static final int SDL_MINOR_VERSION = 28;
|
||||
private static final int SDL_MICRO_VERSION = 5;
|
||||
/*
|
||||
// Display InputType.SOURCE/CLASS of events and devices
|
||||
//
|
||||
@@ -93,7 +93,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
|
||||
s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
tst = InputDevice.SOURCE_BLUETOOTH_STYLUS;
|
||||
if ((s & tst) == tst) src += " BLUETOOTH_STYLUS";
|
||||
s2 &= ~tst;
|
||||
@@ -107,7 +107,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
if ((s & tst) == tst) src += " GAMEPAD";
|
||||
s2 &= ~tst;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
tst = InputDevice.SOURCE_HDMI;
|
||||
if ((s & tst) == tst) src += " HDMI";
|
||||
s2 &= ~tst;
|
||||
@@ -146,7 +146,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
if ((s & tst) == tst) src += " TOUCHSCREEN";
|
||||
s2 &= ~tst;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
if (Build.VERSION.SDK_INT >= 18) {
|
||||
tst = InputDevice.SOURCE_TOUCH_NAVIGATION;
|
||||
if ((s & tst) == tst) src += " TOUCH_NAVIGATION";
|
||||
s2 &= ~tst;
|
||||
@@ -170,7 +170,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
*/
|
||||
|
||||
public static boolean mIsResumedCalled, mHasFocus;
|
||||
public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24);
|
||||
public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */);
|
||||
|
||||
// Cursor types
|
||||
// private static final int SDL_SYSTEM_CURSOR_NONE = -1;
|
||||
@@ -224,9 +224,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
|
||||
protected static SDLGenericMotionListener_API12 getMotionListener() {
|
||||
if (mMotionListener == null) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
if (Build.VERSION.SDK_INT >= 26 /* Android 8.0 (O) */) {
|
||||
mMotionListener = new SDLGenericMotionListener_API26();
|
||||
} else if (Build.VERSION.SDK_INT >= 24) {
|
||||
} else if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
|
||||
mMotionListener = new SDLGenericMotionListener_API24();
|
||||
} else {
|
||||
mMotionListener = new SDLGenericMotionListener_API12();
|
||||
@@ -393,7 +393,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
mHIDDeviceManager = HIDDeviceManager.acquire(this);
|
||||
|
||||
// Set up the surface
|
||||
mSurface = createSDLSurface(getApplication());
|
||||
mSurface = createSDLSurface(this);
|
||||
|
||||
mLayout = new RelativeLayout(this);
|
||||
mLayout.addView(mSurface);
|
||||
@@ -404,7 +404,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
SDLActivity.onNativeOrientationChanged(mCurrentOrientation);
|
||||
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT < 24) {
|
||||
if (Build.VERSION.SDK_INT < 24 /* Android 7.0 (N) */) {
|
||||
mCurrentLocale = getContext().getResources().getConfiguration().locale;
|
||||
} else {
|
||||
mCurrentLocale = getContext().getResources().getConfiguration().getLocales().get(0);
|
||||
@@ -588,6 +588,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
mHIDDeviceManager = null;
|
||||
}
|
||||
|
||||
SDLAudioManager.release(this);
|
||||
|
||||
if (SDLActivity.mBrokenLibraries) {
|
||||
super.onDestroy();
|
||||
return;
|
||||
@@ -766,7 +768,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
}
|
||||
break;
|
||||
case COMMAND_CHANGE_WINDOW_STYLE:
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
|
||||
if (context instanceof Activity) {
|
||||
Window window = ((Activity) context).getWindow();
|
||||
if (window != null) {
|
||||
@@ -841,7 +843,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
msg.obj = data;
|
||||
boolean result = commandHandler.sendMessage(msg);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
|
||||
if (command == COMMAND_CHANGE_WINDOW_STYLE) {
|
||||
// Ensure we don't return until the resize has actually happened,
|
||||
// or 500ms have passed.
|
||||
@@ -969,15 +971,18 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
/* If set, hint "explicitly controls which UI orientations are allowed". */
|
||||
if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) {
|
||||
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
|
||||
} else if (hint.contains("LandscapeRight")) {
|
||||
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
|
||||
} else if (hint.contains("LandscapeLeft")) {
|
||||
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
|
||||
} else if (hint.contains("LandscapeRight")) {
|
||||
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
|
||||
}
|
||||
|
||||
if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) {
|
||||
/* exact match to 'Portrait' to distinguish with PortraitUpsideDown */
|
||||
boolean contains_Portrait = hint.contains("Portrait ") || hint.endsWith("Portrait");
|
||||
|
||||
if (contains_Portrait && hint.contains("PortraitUpsideDown")) {
|
||||
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
|
||||
} else if (hint.contains("Portrait")) {
|
||||
} else if (contains_Portrait) {
|
||||
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
|
||||
} else if (hint.contains("PortraitUpsideDown")) {
|
||||
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
|
||||
@@ -1090,7 +1095,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
// thus SDK version 27. If we are in DeX mode and not API 27 or higher, as a result,
|
||||
// we should stick to relative mode.
|
||||
//
|
||||
if ((Build.VERSION.SDK_INT < 27) && isDeXMode()) {
|
||||
if (Build.VERSION.SDK_INT < 27 /* Android 8.1 (O_MR1) */ && isDeXMode()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1180,7 +1185,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
* This method is called by SDL using JNI.
|
||||
*/
|
||||
public static boolean isDeXMode() {
|
||||
if (Build.VERSION.SDK_INT < 24) {
|
||||
if (Build.VERSION.SDK_INT < 24 /* Android 7.0 (N) */) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
@@ -1340,23 +1345,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
}
|
||||
}
|
||||
|
||||
if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if (isTextInputEvent(event)) {
|
||||
if (ic != null) {
|
||||
ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
|
||||
} else {
|
||||
SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1);
|
||||
}
|
||||
}
|
||||
onNativeKeyDown(keyCode);
|
||||
return true;
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
onNativeKeyUp(keyCode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) {
|
||||
// on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses
|
||||
// they are ignored here because sending them as mouse input to SDL is messy
|
||||
@@ -1371,6 +1359,21 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if (isTextInputEvent(event)) {
|
||||
if (ic != null) {
|
||||
ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
|
||||
} else {
|
||||
SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1);
|
||||
}
|
||||
}
|
||||
onNativeKeyDown(keyCode);
|
||||
return true;
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
onNativeKeyUp(keyCode);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1617,7 +1620,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
private final Runnable rehideSystemUi = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
|
||||
int flags = View.SYSTEM_UI_FLAG_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
|
||||
@@ -1670,7 +1673,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
Bitmap bitmap = Bitmap.createBitmap(colors, width, height, Bitmap.Config.ARGB_8888);
|
||||
++mLastCursorID;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
|
||||
try {
|
||||
mCursors.put(mLastCursorID, PointerIcon.create(bitmap, hotSpotX, hotSpotY));
|
||||
} catch (Exception e) {
|
||||
@@ -1686,7 +1689,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
* This method is called by SDL using JNI.
|
||||
*/
|
||||
public static void destroyCustomCursor(int cursorID) {
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
|
||||
try {
|
||||
mCursors.remove(cursorID);
|
||||
} catch (Exception e) {
|
||||
@@ -1700,7 +1703,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
*/
|
||||
public static boolean setCustomCursor(int cursorID) {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
|
||||
try {
|
||||
mSurface.setPointerIcon(mCursors.get(cursorID));
|
||||
} catch (Exception e) {
|
||||
@@ -1755,7 +1758,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
cursor_type = 1002; //PointerIcon.TYPE_HAND;
|
||||
break;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
|
||||
try {
|
||||
mSurface.setPointerIcon(PointerIcon.getSystemIcon(SDL.getContext(), cursor_type));
|
||||
} catch (Exception e) {
|
||||
@@ -1769,7 +1772,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
* This method is called by SDL using JNI.
|
||||
*/
|
||||
public static void requestPermission(String permission, int requestCode) {
|
||||
if (Build.VERSION.SDK_INT < 23) {
|
||||
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
|
||||
nativePermissionResult(requestCode, true);
|
||||
return;
|
||||
}
|
||||
@@ -1798,7 +1801,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
i.setData(Uri.parse(url));
|
||||
|
||||
int flags = Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
|
||||
flags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
|
||||
} else {
|
||||
flags |= Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET;
|
||||
@@ -2002,6 +2005,18 @@ class SDLInputConnection extends BaseInputConnection {
|
||||
|
||||
@Override
|
||||
public boolean deleteSurroundingText(int beforeLength, int afterLength) {
|
||||
if (Build.VERSION.SDK_INT <= 29 /* Android 10.0 (Q) */) {
|
||||
// Workaround to capture backspace key. Ref: http://stackoverflow.com/questions>/14560344/android-backspace-in-webview-baseinputconnection
|
||||
// and https://bugzilla.libsdl.org/show_bug.cgi?id=2265
|
||||
if (beforeLength > 0 && afterLength == 0) {
|
||||
// backspace(s)
|
||||
while (beforeLength-- > 0) {
|
||||
nativeGenerateScancodeForUnichar('\b');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!super.deleteSurroundingText(beforeLength, afterLength)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package org.libsdl.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.media.AudioDeviceCallback;
|
||||
import android.media.AudioDeviceInfo;
|
||||
import android.media.AudioFormat;
|
||||
import android.media.AudioManager;
|
||||
import android.media.AudioRecord;
|
||||
@@ -8,34 +11,67 @@ import android.media.MediaRecorder;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
public class SDLAudioManager
|
||||
{
|
||||
import java.util.Arrays;
|
||||
|
||||
public class SDLAudioManager {
|
||||
protected static final String TAG = "SDLAudio";
|
||||
|
||||
protected static AudioTrack mAudioTrack;
|
||||
protected static AudioRecord mAudioRecord;
|
||||
protected static Context mContext;
|
||||
|
||||
private static final int[] NO_DEVICES = {};
|
||||
|
||||
private static AudioDeviceCallback mAudioDeviceCallback;
|
||||
|
||||
public static void initialize() {
|
||||
mAudioTrack = null;
|
||||
mAudioRecord = null;
|
||||
mAudioDeviceCallback = null;
|
||||
|
||||
if(Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */)
|
||||
{
|
||||
mAudioDeviceCallback = new AudioDeviceCallback() {
|
||||
@Override
|
||||
public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
|
||||
Arrays.stream(addedDevices).forEach(deviceInfo -> addAudioDevice(deviceInfo.isSink(), deviceInfo.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
|
||||
Arrays.stream(removedDevices).forEach(deviceInfo -> removeAudioDevice(deviceInfo.isSink(), deviceInfo.getId()));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static void setContext(Context context) {
|
||||
mContext = context;
|
||||
if (context != null) {
|
||||
registerAudioDeviceCallback();
|
||||
}
|
||||
}
|
||||
|
||||
public static void release(Context context) {
|
||||
unregisterAudioDeviceCallback(context);
|
||||
}
|
||||
|
||||
// Audio
|
||||
|
||||
protected static String getAudioFormatString(int audioFormat) {
|
||||
switch (audioFormat) {
|
||||
case AudioFormat.ENCODING_PCM_8BIT:
|
||||
return "8-bit";
|
||||
case AudioFormat.ENCODING_PCM_16BIT:
|
||||
return "16-bit";
|
||||
case AudioFormat.ENCODING_PCM_FLOAT:
|
||||
return "float";
|
||||
default:
|
||||
return Integer.toString(audioFormat);
|
||||
case AudioFormat.ENCODING_PCM_8BIT:
|
||||
return "8-bit";
|
||||
case AudioFormat.ENCODING_PCM_16BIT:
|
||||
return "16-bit";
|
||||
case AudioFormat.ENCODING_PCM_FLOAT:
|
||||
return "float";
|
||||
default:
|
||||
return Integer.toString(audioFormat);
|
||||
}
|
||||
}
|
||||
|
||||
protected static int[] open(boolean isCapture, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
|
||||
protected static int[] open(boolean isCapture, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
|
||||
int channelConfig;
|
||||
int sampleSize;
|
||||
int frameSize;
|
||||
@@ -43,14 +79,14 @@ public class SDLAudioManager
|
||||
Log.v(TAG, "Opening " + (isCapture ? "capture" : "playback") + ", requested " + desiredFrames + " frames of " + desiredChannels + " channel " + getAudioFormatString(audioFormat) + " audio at " + sampleRate + " Hz");
|
||||
|
||||
/* On older devices let's use known good settings */
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
if (Build.VERSION.SDK_INT < 21 /* Android 5.0 (LOLLIPOP) */) {
|
||||
if (desiredChannels > 2) {
|
||||
desiredChannels = 2;
|
||||
}
|
||||
}
|
||||
|
||||
/* AudioTrack has sample rate limitation of 48000 (fixed in 5.0.2) */
|
||||
if (Build.VERSION.SDK_INT < 22) {
|
||||
if (Build.VERSION.SDK_INT < 22 /* Android 5.1 (LOLLIPOP_MR1) */) {
|
||||
if (sampleRate < 8000) {
|
||||
sampleRate = 8000;
|
||||
} else if (sampleRate > 48000) {
|
||||
@@ -59,7 +95,7 @@ public class SDLAudioManager
|
||||
}
|
||||
|
||||
if (audioFormat == AudioFormat.ENCODING_PCM_FLOAT) {
|
||||
int minSDKVersion = (isCapture ? 23 : 21);
|
||||
int minSDKVersion = (isCapture ? 23 /* Android 6.0 (M) */ : 21 /* Android 5.0 (LOLLIPOP) */);
|
||||
if (Build.VERSION.SDK_INT < minSDKVersion) {
|
||||
audioFormat = AudioFormat.ENCODING_PCM_16BIT;
|
||||
}
|
||||
@@ -120,7 +156,7 @@ public class SDLAudioManager
|
||||
channelConfig = AudioFormat.CHANNEL_OUT_5POINT1 | AudioFormat.CHANNEL_OUT_BACK_CENTER;
|
||||
break;
|
||||
case 8:
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
if (Build.VERSION.SDK_INT >= 23 /* Android 6.0 (M) */) {
|
||||
channelConfig = AudioFormat.CHANNEL_OUT_7POINT1_SURROUND;
|
||||
} else {
|
||||
Log.v(TAG, "Requested " + desiredChannels + " channels, getting 5.1 surround");
|
||||
@@ -201,6 +237,10 @@ public class SDLAudioManager
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */ && deviceId != 0) {
|
||||
mAudioRecord.setPreferredDevice(getOutputAudioDeviceInfo(deviceId));
|
||||
}
|
||||
|
||||
mAudioRecord.startRecording();
|
||||
}
|
||||
|
||||
@@ -224,6 +264,10 @@ public class SDLAudioManager
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */ && deviceId != 0) {
|
||||
mAudioTrack.setPreferredDevice(getInputAudioDeviceInfo(deviceId));
|
||||
}
|
||||
|
||||
mAudioTrack.play();
|
||||
}
|
||||
|
||||
@@ -238,11 +282,73 @@ public class SDLAudioManager
|
||||
return results;
|
||||
}
|
||||
|
||||
private static AudioDeviceInfo getInputAudioDeviceInfo(int deviceId) {
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
|
||||
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
||||
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS))
|
||||
.filter(deviceInfo -> deviceInfo.getId() == deviceId)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static AudioDeviceInfo getOutputAudioDeviceInfo(int deviceId) {
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
|
||||
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
||||
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS))
|
||||
.filter(deviceInfo -> deviceInfo.getId() == deviceId)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerAudioDeviceCallback() {
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
|
||||
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
||||
audioManager.registerAudioDeviceCallback(mAudioDeviceCallback, null);
|
||||
}
|
||||
}
|
||||
|
||||
private static void unregisterAudioDeviceCallback(Context context) {
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
|
||||
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
|
||||
audioManager.unregisterAudioDeviceCallback(mAudioDeviceCallback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called by SDL using JNI.
|
||||
*/
|
||||
public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
|
||||
return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames);
|
||||
public static int[] getAudioOutputDevices() {
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
|
||||
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
||||
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS)).mapToInt(AudioDeviceInfo::getId).toArray();
|
||||
} else {
|
||||
return NO_DEVICES;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called by SDL using JNI.
|
||||
*/
|
||||
public static int[] getAudioInputDevices() {
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
|
||||
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
||||
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS)).mapToInt(AudioDeviceInfo::getId).toArray();
|
||||
} else {
|
||||
return NO_DEVICES;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called by SDL using JNI.
|
||||
*/
|
||||
public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
|
||||
return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames, deviceId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,6 +360,11 @@ public class SDLAudioManager
|
||||
return;
|
||||
}
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT < 21 /* Android 5.0 (LOLLIPOP) */) {
|
||||
Log.e(TAG, "Attempted to make an incompatible audio call with uninitialized audio! (floating-point output is supported since Android 5.0 Lollipop)");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < buffer.length;) {
|
||||
int result = mAudioTrack.write(buffer, i, buffer.length - i, AudioTrack.WRITE_BLOCKING);
|
||||
if (result > 0) {
|
||||
@@ -326,18 +437,22 @@ public class SDLAudioManager
|
||||
/**
|
||||
* This method is called by SDL using JNI.
|
||||
*/
|
||||
public static int[] captureOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
|
||||
return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames);
|
||||
public static int[] captureOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
|
||||
return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames, deviceId);
|
||||
}
|
||||
|
||||
/** This method is called by SDL using JNI. */
|
||||
public static int captureReadFloatBuffer(float[] buffer, boolean blocking) {
|
||||
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
|
||||
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
|
||||
return 0;
|
||||
} else {
|
||||
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
|
||||
}
|
||||
}
|
||||
|
||||
/** This method is called by SDL using JNI. */
|
||||
public static int captureReadShortBuffer(short[] buffer, boolean blocking) {
|
||||
if (Build.VERSION.SDK_INT < 23) {
|
||||
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
|
||||
return mAudioRecord.read(buffer, 0, buffer.length);
|
||||
} else {
|
||||
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
|
||||
@@ -346,7 +461,7 @@ public class SDLAudioManager
|
||||
|
||||
/** This method is called by SDL using JNI. */
|
||||
public static int captureReadByteBuffer(byte[] buffer, boolean blocking) {
|
||||
if (Build.VERSION.SDK_INT < 23) {
|
||||
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
|
||||
return mAudioRecord.read(buffer, 0, buffer.length);
|
||||
} else {
|
||||
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
|
||||
@@ -391,4 +506,9 @@ public class SDLAudioManager
|
||||
}
|
||||
|
||||
public static native int nativeSetupJNI();
|
||||
|
||||
public static native void removeAudioDevice(boolean isCapture, int deviceId);
|
||||
|
||||
public static native void addAudioDevice(boolean isCapture, int deviceId);
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class SDLControllerManager
|
||||
public static native int nativeAddJoystick(int device_id, String name, String desc,
|
||||
int vendor_id, int product_id,
|
||||
boolean is_accelerometer, int button_mask,
|
||||
int naxes, int nhats, int nballs);
|
||||
int naxes, int axis_mask, int nhats, int nballs);
|
||||
public static native int nativeRemoveJoystick(int device_id);
|
||||
public static native int nativeAddHaptic(int device_id, String name);
|
||||
public static native int nativeRemoveHaptic(int device_id);
|
||||
@@ -42,7 +42,7 @@ public class SDLControllerManager
|
||||
|
||||
public static void initialize() {
|
||||
if (mJoystickHandler == null) {
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
|
||||
mJoystickHandler = new SDLJoystickHandler_API19();
|
||||
} else {
|
||||
mJoystickHandler = new SDLJoystickHandler_API16();
|
||||
@@ -50,7 +50,7 @@ public class SDLControllerManager
|
||||
}
|
||||
|
||||
if (mHapticHandler == null) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
if (Build.VERSION.SDK_INT >= 26 /* Android 8.0 (O) */) {
|
||||
mHapticHandler = new SDLHapticHandler_API26();
|
||||
} else {
|
||||
mHapticHandler = new SDLHapticHandler();
|
||||
@@ -168,6 +168,32 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
|
||||
arg1Axis = MotionEvent.AXIS_GAS;
|
||||
}
|
||||
|
||||
// Make sure the AXIS_Z is sorted between AXIS_RY and AXIS_RZ.
|
||||
// This is because the usual pairing are:
|
||||
// - AXIS_X + AXIS_Y (left stick).
|
||||
// - AXIS_RX, AXIS_RY (sometimes the right stick, sometimes triggers).
|
||||
// - AXIS_Z, AXIS_RZ (sometimes the right stick, sometimes triggers).
|
||||
// This sorts the axes in the above order, which tends to be correct
|
||||
// for Xbox-ish game pads that have the right stick on RX/RY and the
|
||||
// triggers on Z/RZ.
|
||||
//
|
||||
// Gamepads that don't have AXIS_Z/AXIS_RZ but use
|
||||
// AXIS_LTRIGGER/AXIS_RTRIGGER are unaffected by this.
|
||||
//
|
||||
// References:
|
||||
// - https://developer.android.com/develop/ui/views/touch-and-input/game-controllers/controller-input
|
||||
// - https://www.kernel.org/doc/html/latest/input/gamepad.html
|
||||
if (arg0Axis == MotionEvent.AXIS_Z) {
|
||||
arg0Axis = MotionEvent.AXIS_RZ - 1;
|
||||
} else if (arg0Axis > MotionEvent.AXIS_Z && arg0Axis < MotionEvent.AXIS_RZ) {
|
||||
--arg0Axis;
|
||||
}
|
||||
if (arg1Axis == MotionEvent.AXIS_Z) {
|
||||
arg1Axis = MotionEvent.AXIS_RZ - 1;
|
||||
} else if (arg1Axis > MotionEvent.AXIS_Z && arg1Axis < MotionEvent.AXIS_RZ) {
|
||||
--arg1Axis;
|
||||
}
|
||||
|
||||
return arg0Axis - arg1Axis;
|
||||
}
|
||||
}
|
||||
@@ -210,7 +236,7 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
|
||||
mJoysticks.add(joystick);
|
||||
SDLControllerManager.nativeAddJoystick(joystick.device_id, joystick.name, joystick.desc,
|
||||
getVendorId(joystickDevice), getProductId(joystickDevice), false,
|
||||
getButtonMask(joystickDevice), joystick.axes.size(), joystick.hats.size()/2, 0);
|
||||
getButtonMask(joystickDevice), joystick.axes.size(), getAxisMask(joystick.axes), joystick.hats.size()/2, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -291,6 +317,9 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
|
||||
public int getVendorId(InputDevice joystickDevice) {
|
||||
return 0;
|
||||
}
|
||||
public int getAxisMask(List<InputDevice.MotionRange> ranges) {
|
||||
return -1;
|
||||
}
|
||||
public int getButtonMask(InputDevice joystickDevice) {
|
||||
return -1;
|
||||
}
|
||||
@@ -308,6 +337,43 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 {
|
||||
return joystickDevice.getVendorId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAxisMask(List<InputDevice.MotionRange> ranges) {
|
||||
// For compatibility, keep computing the axis mask like before,
|
||||
// only really distinguishing 2, 4 and 6 axes.
|
||||
int axis_mask = 0;
|
||||
if (ranges.size() >= 2) {
|
||||
// ((1 << SDL_GAMEPAD_AXIS_LEFTX) | (1 << SDL_GAMEPAD_AXIS_LEFTY))
|
||||
axis_mask |= 0x0003;
|
||||
}
|
||||
if (ranges.size() >= 4) {
|
||||
// ((1 << SDL_GAMEPAD_AXIS_RIGHTX) | (1 << SDL_GAMEPAD_AXIS_RIGHTY))
|
||||
axis_mask |= 0x000c;
|
||||
}
|
||||
if (ranges.size() >= 6) {
|
||||
// ((1 << SDL_GAMEPAD_AXIS_LEFT_TRIGGER) | (1 << SDL_GAMEPAD_AXIS_RIGHT_TRIGGER))
|
||||
axis_mask |= 0x0030;
|
||||
}
|
||||
// Also add an indicator bit for whether the sorting order has changed.
|
||||
// This serves to disable outdated gamecontrollerdb.txt mappings.
|
||||
boolean have_z = false;
|
||||
boolean have_past_z_before_rz = false;
|
||||
for (InputDevice.MotionRange range : ranges) {
|
||||
int axis = range.getAxis();
|
||||
if (axis == MotionEvent.AXIS_Z) {
|
||||
have_z = true;
|
||||
} else if (axis > MotionEvent.AXIS_Z && axis < MotionEvent.AXIS_RZ) {
|
||||
have_past_z_before_rz = true;
|
||||
}
|
||||
}
|
||||
if (have_z && have_past_z_before_rz) {
|
||||
// If both these exist, the compare() function changed sorting order.
|
||||
// Set a bit to indicate this fact.
|
||||
axis_mask |= 0x8000;
|
||||
}
|
||||
return axis_mask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getButtonMask(InputDevice joystickDevice) {
|
||||
int button_mask = 0;
|
||||
@@ -743,7 +809,7 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
|
||||
|
||||
@Override
|
||||
public boolean supportsRelativeMouse() {
|
||||
return (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27));
|
||||
return (!SDLActivity.isDeXMode() || Build.VERSION.SDK_INT >= 27 /* Android 8.1 (O_MR1) */);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -753,7 +819,7 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
|
||||
|
||||
@Override
|
||||
public boolean setRelativeMouseEnabled(boolean enabled) {
|
||||
if (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27)) {
|
||||
if (!SDLActivity.isDeXMode() || Build.VERSION.SDK_INT >= 27 /* Android 8.1 (O_MR1) */) {
|
||||
if (enabled) {
|
||||
SDLActivity.getContentView().requestPointerCapture();
|
||||
} else {
|
||||
|
||||
@@ -116,7 +116,7 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
||||
int nDeviceHeight = height;
|
||||
try
|
||||
{
|
||||
if (Build.VERSION.SDK_INT >= 17) {
|
||||
if (Build.VERSION.SDK_INT >= 17 /* Android 4.2 (JELLY_BEAN_MR1) */) {
|
||||
DisplayMetrics realMetrics = new DisplayMetrics();
|
||||
mDisplay.getRealMetrics( realMetrics );
|
||||
nDeviceWidth = realMetrics.widthPixels;
|
||||
@@ -163,7 +163,7 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
||||
|
||||
// Don't skip in MultiWindow.
|
||||
if (skip) {
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
|
||||
if (SDLActivity.mSingleton.isInMultiWindowMode()) {
|
||||
Log.v("SDL", "Don't skip in Multi-Window");
|
||||
skip = false;
|
||||
|
||||
@@ -7,7 +7,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.3.1'
|
||||
classpath 'com.android.tools.build:gradle:8.1.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#Thu Nov 11 18:20:34 PST 2021
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
Vendored
+2
-2
@@ -126,8 +126,8 @@ if $cygwin ; then
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
CHECK=`echo "$arg"|grep -E -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|grep -E -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
|
||||
+1
-4
@@ -1,7 +1,5 @@
|
||||
#cmakedefine PACKAGE "@PACKAGE@"
|
||||
#define VERSION "2.9.1"
|
||||
|
||||
#cmakedefine CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
|
||||
#define VERSION "2.11.0"
|
||||
|
||||
#cmakedefine CACHE_TOTALSIZE @CACHE_TOTALSIZE@
|
||||
|
||||
@@ -27,7 +25,6 @@
|
||||
#cmakedefine HAVE_GETLOGIN @HAVE_GETLOGIN@
|
||||
#cmakedefine HAVE_MMAP @HAVE_MMAP@
|
||||
#cmakedefine HAVE_SIGACTION @HAVE_SIGACTION@
|
||||
#cmakedefine HAVE_UNAME @HAVE_UNAME@
|
||||
#cmakedefine HAVE_WEBP @HAVE_WEBP@
|
||||
|
||||
#define DEFAULT_GOTHIC_TTF "@DEFAULT_FONT_PATH@MTLc3m.ttf"
|
||||
|
||||
+3
-16
@@ -98,20 +98,7 @@ endif()
|
||||
|
||||
target_compile_options(modules PRIVATE -Wno-pointer-sign)
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
set(LIBS
|
||||
"SHELL:-s USE_ZLIB=1"
|
||||
"SHELL:-s USE_SDL=2")
|
||||
target_compile_options(modules PRIVATE ${LIBS})
|
||||
target_link_options(modules PRIVATE ${LIBS})
|
||||
elseif (ANDROID)
|
||||
target_link_libraries(modules PRIVATE ${ndk_zlib})
|
||||
if (SDL2MIXER_FOUND)
|
||||
target_link_libraries(modules PRIVATE SDL2 SDL2_mixer)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(modules PRIVATE ZLIB::ZLIB)
|
||||
if (SDL2MIXER_FOUND)
|
||||
target_link_libraries(modules PRIVATE PkgConfig::SDL2MIXER)
|
||||
endif()
|
||||
target_link_libraries(modules PRIVATE sdl2 zlib)
|
||||
if (TARGET sdl2_mixer)
|
||||
target_link_libraries(modules PRIVATE sdl2_mixer)
|
||||
endif()
|
||||
|
||||
@@ -197,8 +197,10 @@ static void setup_selwindow() {
|
||||
|
||||
// デフォルトで選択される選択肢がある場合、そこへカーソルを移動
|
||||
if (sact.sel.movecursor) {
|
||||
ags_setCursorLocation(sp->cur.x + sact.sel.frame_dot + 2,
|
||||
sp->cur.y + sact.sel.frame_dot + 2 + (sact.sel.font_size + sact.sel.linespace)*(sact.sel.movecursor -1), TRUE);
|
||||
int x = sp->cur.x + sact.sel.frame_dot + 2;
|
||||
int y = sp->cur.y + sact.sel.frame_dot + 2 +
|
||||
(sact.sel.font_size + sact.sel.linespace) * (sact.sel.movecursor - 1);
|
||||
ags_setCursorLocation(x, y, true, true);
|
||||
selected_item = (sact.sel.movecursor -1);
|
||||
oldstate = TRUE;
|
||||
oldindex = selected_item -1;
|
||||
|
||||
@@ -1306,7 +1306,7 @@ static void ChangeSecretArray(void) { /* 53 */
|
||||
(*vAry) ^= ax; ax = (key[i&3] ^ *vAry);
|
||||
j ^= ax;
|
||||
if (i & 2) {
|
||||
ax = !ax ^ (i*3);
|
||||
ax = ~ax ^ (i*3);
|
||||
}
|
||||
if (i & 4) {
|
||||
ax = (ax >> 4) | (ax << 12);
|
||||
@@ -1328,13 +1328,12 @@ static void ChangeSecretArray(void) { /* 53 */
|
||||
*vAry ^= ax; ax = (key[i&3] ^ k);
|
||||
j ^= ax;
|
||||
if (i & 2) {
|
||||
ax = !ax ^ (i*3);
|
||||
ax = ~ax ^ (i*3);
|
||||
}
|
||||
if (i & 4) {
|
||||
ax = (ax >> 4) | (ax << 12);
|
||||
}
|
||||
vAry++;
|
||||
|
||||
}
|
||||
*vResult = j;
|
||||
}
|
||||
|
||||
+16
-27
@@ -11,6 +11,9 @@ if (ANDROID)
|
||||
add_library(xsystem35 SHARED)
|
||||
else()
|
||||
add_executable(xsystem35)
|
||||
if (WIN32)
|
||||
target_link_options(xsystem35 PRIVATE -static)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_compile_options(xsystem35 PRIVATE -Wno-pointer-sign $<$<CONFIG:Debug>:-Wall>)
|
||||
@@ -44,7 +47,7 @@ target_sources(xsystem35 PRIVATE
|
||||
pms.c vsp.c bmp.c qnt.c jpeg.c)
|
||||
if (HAVE_WEBP)
|
||||
target_sources(xsystem35 PRIVATE webp.c)
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::WEBP)
|
||||
target_link_libraries(xsystem35 PRIVATE WebP)
|
||||
endif()
|
||||
|
||||
# Music
|
||||
@@ -75,18 +78,17 @@ if (ENABLE_DEBUGGER)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
target_sources(xsystem35 PRIVATE win/dialog.c win/resources.rc win/menubar.c win/console.c)
|
||||
target_sources(xsystem35 PRIVATE
|
||||
win/dialog.c win/resources.rc win/resources.c win/menubar.c win/console.c)
|
||||
endif()
|
||||
|
||||
target_link_libraries(src_lib PRIVATE sdl2 zlib)
|
||||
target_link_libraries(xsystem35 PRIVATE m zlib sdl2 sdl2_ttf)
|
||||
if (TARGET sdl2_mixer)
|
||||
target_link_libraries(xsystem35 PRIVATE sdl2_mixer)
|
||||
endif()
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
|
||||
set(LIBS
|
||||
"SHELL:-s USE_ZLIB=1"
|
||||
"SHELL:-s USE_SDL=2"
|
||||
"SHELL:-s USE_SDL_TTF=2")
|
||||
target_compile_options(src_lib PRIVATE ${LIBS})
|
||||
target_compile_options(xsystem35 PRIVATE ${LIBS})
|
||||
target_link_options(xsystem35 PRIVATE ${LIBS})
|
||||
target_link_libraries(xsystem35 PRIVATE idbfs.js)
|
||||
|
||||
# Without optimizations, Asyncify generates very large code.
|
||||
@@ -104,28 +106,15 @@ if (EMSCRIPTEN)
|
||||
"SHELL:-s EXPORTED_RUNTIME_METHODS=getValue,addRunDependency,removeRunDependency")
|
||||
|
||||
elseif (ANDROID)
|
||||
|
||||
target_link_libraries(src_lib PRIVATE SDL2)
|
||||
target_link_libraries(xsystem35 PRIVATE SDL2 SDL2_ttf SDL2_mixer ${ndk_zlib} ${ndk_log})
|
||||
target_link_libraries(xsystem35 PRIVATE ${ndk_log})
|
||||
|
||||
else() # non-emscripten, non-android
|
||||
target_link_libraries(src_lib PRIVATE PkgConfig::SDL2)
|
||||
target_link_libraries(xsystem35 PRIVATE m ZLIB::ZLIB)
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::SDL2)
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::SDL2TTF)
|
||||
if (TARGET cJSON)
|
||||
target_link_libraries(xsystem35 PRIVATE cJSON)
|
||||
endif()
|
||||
if (GTK3_FOUND)
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::GTK3)
|
||||
endif()
|
||||
if (SDL2MIXER_FOUND)
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::SDL2MIXER)
|
||||
endif()
|
||||
if (ENABLE_DEBUGGER)
|
||||
if (cJSON_FOUND)
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::cJSON)
|
||||
else()
|
||||
target_link_libraries(xsystem35 PRIVATE ${cJSON})
|
||||
endif()
|
||||
endif()
|
||||
if (ENABLE_MIDI_PORTMIDI)
|
||||
target_link_libraries(xsystem35 PRIVATE ${PORTMIDI})
|
||||
endif()
|
||||
|
||||
@@ -42,23 +42,44 @@
|
||||
#include "font.h"
|
||||
#include "cursor.h"
|
||||
#include "image.h"
|
||||
#include "debugger.h"
|
||||
|
||||
static Palette256 pal_256;
|
||||
static boolean need_update = TRUE;
|
||||
static boolean fade_outed = FALSE;
|
||||
static int cursor_move_time = 50; /* カーソル移動にかかる時間(ms) */
|
||||
|
||||
static void initPal(Palette256 *pal) {
|
||||
int i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
pal->red[i] = 0; pal->green[i] = 0; pal->blue[i] = 0;
|
||||
}
|
||||
pal->red[0] = 0; pal->green[0] = 0; pal->blue[0] = 0;
|
||||
pal->red[7] = 255; pal->green[7] = 255; pal->blue[7] = 255;
|
||||
pal->red[15] = 255; pal->green[15] = 255; pal->blue[15] = 255;
|
||||
pal->red[255] = 255; pal->green[255] = 255; pal->blue[255] = 255;
|
||||
sdl_setPalette(pal, 0, 256);
|
||||
static void palette_changed(void) {
|
||||
nact->ags.pal_changed = TRUE;
|
||||
dbg_on_palette_change();
|
||||
}
|
||||
|
||||
static void initPal(void) {
|
||||
static const Color initial_palette[256] = {
|
||||
[ 0] = { 0, 0, 0},
|
||||
[ 1] = {128, 0, 0},
|
||||
[ 2] = { 0, 128, 0},
|
||||
[ 3] = {128, 128, 0},
|
||||
[ 4] = { 0, 0, 128},
|
||||
[ 5] = {128, 0, 128},
|
||||
[ 6] = { 0, 128, 128},
|
||||
[ 7] = {192, 192, 192},
|
||||
[ 8] = {192, 220, 192},
|
||||
[ 9] = {166, 202, 240},
|
||||
[ 15] = {255, 255, 255},
|
||||
[246] = {255, 251, 240},
|
||||
[247] = {160, 160, 164},
|
||||
[248] = {128, 128, 128},
|
||||
[249] = {255, 0, 0},
|
||||
[250] = { 0, 255, 0},
|
||||
[251] = {255, 255, 0},
|
||||
[252] = { 0, 0, 255},
|
||||
[253] = {255, 0, 255},
|
||||
[254] = { 0, 255, 255},
|
||||
[255] = {255, 255, 255},
|
||||
};
|
||||
memcpy(nact->ags.pal, initial_palette, sizeof(initial_palette));
|
||||
sdl_setPalette(nact->ags.pal, 0, 256);
|
||||
palette_changed();
|
||||
}
|
||||
|
||||
boolean ags_check_param(int *x, int *y, int *w, int *h) {
|
||||
@@ -99,9 +120,8 @@ boolean ags_check_param_xy(int *x, int *y) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void ags_init(const char *render_driver) {
|
||||
nact->ags.mouse_movesw = MOUSE_WARP_SMOOTH;
|
||||
nact->ags.pal = &pal_256;
|
||||
void ags_init(const char *render_driver, bool enable_zb) {
|
||||
nact->ags.mouse_warp_enabled = true;
|
||||
nact->ags.world_size.width = SYS35_DEFAULT_WIDTH;
|
||||
nact->ags.world_size.height = SYS35_DEFAULT_HEIGHT;
|
||||
nact->ags.world_depth = SYS35_DEFAULT_DEPTH;
|
||||
@@ -109,11 +129,14 @@ void ags_init(const char *render_driver) {
|
||||
nact->ags.view_area.y = 0;
|
||||
nact->ags.view_area.w = SYS35_DEFAULT_WIDTH;
|
||||
nact->ags.view_area.h = SYS35_DEFAULT_HEIGHT;
|
||||
|
||||
nact->ags.enable_zb = enable_zb;
|
||||
nact->ags.font_weight = enable_zb ? FONT_WEIGHT_BOLD : FONT_WEIGHT_NORMAL;
|
||||
|
||||
sdl_Initialize(render_driver);
|
||||
font_init();
|
||||
|
||||
initPal(&pal_256);
|
||||
initPal();
|
||||
cg_init();
|
||||
}
|
||||
|
||||
@@ -123,9 +146,9 @@ void ags_remove(void) {
|
||||
}
|
||||
|
||||
void ags_reset(void) {
|
||||
nact->ags.mouse_movesw = MOUSE_WARP_SMOOTH;
|
||||
nact->ags.mouse_warp_enabled = true;
|
||||
nact->ags.eventcb = NULL;
|
||||
initPal(&pal_256);
|
||||
initPal();
|
||||
cg_reset();
|
||||
}
|
||||
|
||||
@@ -151,7 +174,7 @@ void ags_setWorldSize(int width, int height, int depth) {
|
||||
|
||||
fade_outed = FALSE; /* thanx tajiri@wizard */
|
||||
|
||||
nact->ags.pal_changed = TRUE;
|
||||
palette_changed();
|
||||
}
|
||||
|
||||
void ags_setViewArea(int x, int y, int width, int height) {
|
||||
@@ -216,21 +239,18 @@ void ags_updateFull() {
|
||||
sdl_updateArea(&r, &p);
|
||||
}
|
||||
|
||||
void ags_setPalettes(Palette256 *src_pal, int src, int dst, int cnt) {
|
||||
int i;
|
||||
for (i = 0; i < cnt; i++) {
|
||||
nact->ags.pal->red [dst + i] = src_pal->red [src + i];
|
||||
nact->ags.pal->green[dst + i] = src_pal->green[src + i];
|
||||
nact->ags.pal->blue [dst + i] = src_pal->blue [src + i];
|
||||
void ags_setPalettes(Color *src, int dst, int cnt) {
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
nact->ags.pal[dst + i] = src[i];
|
||||
}
|
||||
nact->ags.pal_changed = TRUE;
|
||||
palette_changed();
|
||||
}
|
||||
|
||||
void ags_setPalette(int no, int red, int green, int blue) {
|
||||
nact->ags.pal->red[no] = red;
|
||||
nact->ags.pal->green[no] = green;
|
||||
nact->ags.pal->blue[no] = blue;
|
||||
nact->ags.pal_changed = TRUE;
|
||||
nact->ags.pal[no].r = red;
|
||||
nact->ags.pal[no].g = green;
|
||||
nact->ags.pal[no].b = blue;
|
||||
palette_changed();
|
||||
}
|
||||
|
||||
void ags_setPaletteToSystem(int src, int cnt) {
|
||||
@@ -577,9 +597,9 @@ void ags_fadeOut(int rate, boolean flag) {
|
||||
fade(duration, flag, nact->ags.world_depth == 8 ? EFFECT_FADEOUT : EFFECT_DITHERING_FADEOUT);
|
||||
|
||||
if (nact->ags.world_depth == 8) {
|
||||
Palette256 pal;
|
||||
Color pal[256];
|
||||
memset(&pal, 0, sizeof(pal));
|
||||
sdl_setPalette(&pal, 0, 256);
|
||||
sdl_setPalette(pal, 0, 256);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,14 +626,18 @@ void ags_whiteOut(int rate, boolean flag) {
|
||||
fade(duration, flag, nact->ags.world_depth == 8 ? EFFECT_WHITEIN : EFFECT_DITHERING_WHITEOUT);
|
||||
|
||||
if (nact->ags.world_depth == 8) {
|
||||
Palette256 pal;
|
||||
Color pal[256];
|
||||
memset(&pal, 255, sizeof(pal));
|
||||
sdl_setPalette(&pal, 0, 256);
|
||||
sdl_setPalette(pal, 0, 256);
|
||||
}
|
||||
}
|
||||
|
||||
void ags_setFont(int type, int size) {
|
||||
font_select(type, size);
|
||||
font_select(type, size, FONT_WEIGHT_NORMAL);
|
||||
}
|
||||
|
||||
void ags_setFontWithWeight(int type, int size, int weight) {
|
||||
font_select(type, size, weight);
|
||||
}
|
||||
|
||||
void ags_setCursorType(int type) {
|
||||
@@ -627,42 +651,42 @@ void ags_loadCursor(int p1,int p2) {
|
||||
}
|
||||
}
|
||||
|
||||
void ags_setCursorLocation(int x, int y, boolean is_dibgeo) {
|
||||
int dx[8], dy[8];
|
||||
int i, delx, dely;
|
||||
MyPoint p;
|
||||
void ags_setCursorLocation(int x, int y, bool is_dibgeo, bool for_selection) {
|
||||
if (!ags_check_param_xy(&x, &y)) return;
|
||||
|
||||
/* DIB 座表系か Window 座表系か */
|
||||
if (is_dibgeo) {
|
||||
// DIB coordinates -> Window coordinates
|
||||
x -= nact->ags.view_area.x;
|
||||
y -= nact->ags.view_area.y;
|
||||
}
|
||||
|
||||
switch(nact->ags.mouse_movesw) {
|
||||
case MOUSE_WARP_DISABLED:
|
||||
return;
|
||||
case MOUSE_WARP_DIRECT:
|
||||
sdl_setCursorLocation(x, y); break;
|
||||
case MOUSE_WARP_SMOOTH:
|
||||
sys_getMouseInfo(&p, is_dibgeo);
|
||||
delx = x - p.x;
|
||||
dely = y - p.y;
|
||||
|
||||
for (i = 1; i < 8; i++) {
|
||||
dx[i-1] = ((delx*i*i*i) >> 9) - ((3*delx*i*i)>> 6) + ((3*delx*i) >> 3) + p.x;
|
||||
dy[i-1] = ((dely*i*i*i) >> 9) - ((3*dely*i*i)>> 6) + ((3*dely*i) >> 3) + p.y;
|
||||
}
|
||||
dx[7] = x; dy[7] = y;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
sdl_setCursorLocation(dx[i], dy[i]);
|
||||
usleep(cursor_move_time * 1000 / 8);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
if (!for_selection) {
|
||||
// We can't move the actual cursor in the browser, but can change the
|
||||
// internal mouse coordinates. This can help with keyboard/gamepad
|
||||
// navigation.
|
||||
sdl_setCursorInternalLocation(x, y);
|
||||
EM_ASM({ xsystem35.shell.showMouseMoveEffect($0, $1); }, x, y);
|
||||
sdl_sleep(cursor_move_time);
|
||||
}
|
||||
#else
|
||||
if (nact->ags.mouse_warp_enabled) {
|
||||
MyPoint p;
|
||||
sys_getMouseInfo(&p, is_dibgeo);
|
||||
int dx = x - p.x;
|
||||
int dy = y - p.y;
|
||||
for (int i = 1; i < 8; i++) {
|
||||
int xi = ((dx*i*i*i) >> 9) - ((3*dx*i*i)>> 6) + ((3*dx*i) >> 3) + p.x;
|
||||
int yi = ((dy*i*i*i) >> 9) - ((3*dy*i*i)>> 6) + ((3*dy*i) >> 3) + p.y;
|
||||
sdl_setCursorLocation(xi, yi);
|
||||
sdl_sleep(cursor_move_time / 7);
|
||||
}
|
||||
sdl_setCursorLocation(x, y);
|
||||
} else if (!for_selection) {
|
||||
sdl_setCursorInternalLocation(x, y);
|
||||
sdl_sleep(cursor_move_time);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
|
||||
@@ -100,14 +100,8 @@ enum agsevent_button {
|
||||
AGSEVENT_BUTTON_RIGHT,
|
||||
};
|
||||
|
||||
enum mouse_warp_mode {
|
||||
MOUSE_WARP_DISABLED,
|
||||
MOUSE_WARP_DIRECT,
|
||||
MOUSE_WARP_SMOOTH,
|
||||
};
|
||||
|
||||
struct _ags {
|
||||
Palette256 *pal; /* system palette */
|
||||
Color pal[256]; /* system palette */
|
||||
boolean pal_changed; /* system palette has changed */
|
||||
|
||||
MyDimension world_size; /* size of off-screen */
|
||||
@@ -116,11 +110,13 @@ struct _ags {
|
||||
|
||||
int world_depth; /* depth of off-screen (bits per pixel) */
|
||||
|
||||
enum mouse_warp_mode mouse_movesw;
|
||||
|
||||
agsurface_t *dib; /* main surface */
|
||||
void (*eventcb)(agsevent_t *e); /* deliver event */
|
||||
|
||||
int font_weight;
|
||||
|
||||
bool mouse_warp_enabled;
|
||||
bool enable_zb;
|
||||
boolean noantialias; /* antialias を使用しない */
|
||||
boolean noimagecursor; /* リソースファイルのカーソルを読みこまない */
|
||||
};
|
||||
@@ -129,7 +125,7 @@ typedef struct _ags ags_t;
|
||||
|
||||
|
||||
/* 初期化関係 */
|
||||
void ags_init(const char *render_driver);
|
||||
void ags_init(const char *render_driver, bool enable_zb);
|
||||
void ags_remove(void);
|
||||
void ags_reset(void);
|
||||
|
||||
@@ -150,7 +146,7 @@ extern void ags_updateFull(void);
|
||||
extern void ags_updateArea(int x, int y, int width, int height);
|
||||
|
||||
/* パレット関係 */
|
||||
extern void ags_setPalettes(Palette256 *src_pal, int src, int dst, int cnt);
|
||||
extern void ags_setPalettes(Color *src, int dst, int cnt);
|
||||
extern void ags_setPalette(int no, int red, int green, int blue);
|
||||
extern void ags_setPaletteToSystem(int src, int cnt);
|
||||
|
||||
@@ -206,12 +202,13 @@ enum FontType {
|
||||
FONT_MINCHO,
|
||||
};
|
||||
extern void ags_setFont(int type, int size);
|
||||
extern void ags_setFontWithWeight(int type, int size, int weight);
|
||||
extern agsurface_t *ags_drawStringToSurface(const char *str);
|
||||
|
||||
/* カーソル関係 */
|
||||
extern void ags_setCursorType(int type);
|
||||
extern void ags_loadCursor(int ,int);
|
||||
extern void ags_setCursorLocation(int x, int y, boolean dibgeo);
|
||||
extern void ags_setCursorLocation(int x, int y, bool is_dibgeo, bool for_selection);
|
||||
extern void ags_setCursorMoveTime(int msec);
|
||||
extern int ags_getCursorMoveTime();
|
||||
|
||||
|
||||
+1
-1
@@ -108,5 +108,5 @@ void ald_init(int type, const char **file, int cnt, boolean use_mmap) {
|
||||
int ald_get_maxno(DRIFILETYPE type) {
|
||||
if (type >= DRIFILETYPEMAX || !dri[type])
|
||||
return 0;
|
||||
return dri[type]->nr_files;
|
||||
return dri[type]->maxno;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
* static methods
|
||||
*/
|
||||
static bmp_header *extract_header(uint8_t *b);
|
||||
static void getpal(Palette256 *pal, uint8_t *b);
|
||||
static void extract_8bit(bmp_header *bmp, uint8_t *pic, uint8_t *b);
|
||||
static void extract_24bit(bmp_header *bmp, uint16_t *pic, uint8_t *b);
|
||||
|
||||
@@ -65,17 +64,16 @@ static bmp_header *extract_header(uint8_t *b) {
|
||||
|
||||
/*
|
||||
* Get palette from raw data
|
||||
* pal: palette to be stored
|
||||
* b : raw data (pointer to palette)
|
||||
*/
|
||||
static void getpal(Palette256 *pal, uint8_t *b) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
pal->blue[i] = *b++;
|
||||
pal->red[i] = *b++;
|
||||
pal->green[i] = *b++;
|
||||
static Color *getpal(uint8_t *b) {
|
||||
Color *pal = malloc(sizeof(Color) * 256);
|
||||
for (int i = 0; i < 256; i++) {
|
||||
pal[i].b = *b++;
|
||||
pal[i].r = *b++;
|
||||
pal[i].g = *b++;
|
||||
}
|
||||
return pal;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -168,8 +166,7 @@ cgdata *bmp256_extract(uint8_t *data) {
|
||||
bmp_header *bmp = extract_header(data);
|
||||
cgdata *cg = calloc(1, sizeof(cgdata));
|
||||
|
||||
cg->pal = malloc(sizeof(Palette256));
|
||||
getpal(cg->pal, data + bmp->bmpPp);
|
||||
cg->pal = getpal(data + bmp->bmpPp);
|
||||
|
||||
/* +10: margin for broken cg */
|
||||
cg->pic = malloc(sizeof(uint8_t) * ((bmp->bmpXW + 10) * (bmp->bmpYW + 10)));
|
||||
|
||||
@@ -22,11 +22,14 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cdrom.h"
|
||||
#include "ald_manager.h"
|
||||
#include "music.h"
|
||||
#include "music_private.h"
|
||||
|
||||
static int current_track;
|
||||
|
||||
static int cdrom_bgm_init(char *dev) {
|
||||
prv.cd_maxtrk = ald_get_maxno(DRIFILE_BGM) + 1;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -72,7 +72,9 @@ static int cdrom_init(char *playlist_path) {
|
||||
fp = fopen("_inmm.ini", "r");
|
||||
}
|
||||
if (!fp) {
|
||||
NOTICE("cdrom: Cannot open playlist %s", playlist_path);
|
||||
// If the game has MIDI music, lack of the playlist is not a problem.
|
||||
if (ald_get_maxno(DRIFILE_MIDI) == 0)
|
||||
NOTICE("cdrom: Cannot open playlist %s", playlist_path);
|
||||
return NG;
|
||||
}
|
||||
|
||||
|
||||
@@ -293,13 +293,8 @@ void cg_load(int no, int flg) {
|
||||
bank = cg_vspPB == -1 ? cg->vsp_bank : cg_vspPB;
|
||||
set_vspbank(cg->pic, bank << 4, cg->width, cg->height);
|
||||
/* copy palettes 0 -> bank */
|
||||
{
|
||||
int i, i_dst = bank << 4;
|
||||
for (i = 0; i < 16; i++) {
|
||||
cg->pal->red[i + i_dst] = cg->pal->red[i];
|
||||
cg->pal->green[i + i_dst] = cg->pal->green[i];
|
||||
cg->pal->blue[i + i_dst] = cg->pal->blue[i];
|
||||
}
|
||||
if (bank != 0) {
|
||||
memcpy(cg->pal + bank * 16, cg->pal, 16 * sizeof(cg->pal[0]));
|
||||
}
|
||||
if (flg != -1) {
|
||||
flg |= (bank << 4);
|
||||
@@ -310,22 +305,22 @@ void cg_load(int no, int flg) {
|
||||
if (GCMD_LOAD_PALETTE(cg_fflg)) {
|
||||
switch(cg->type) {
|
||||
case ALCG_VSP:
|
||||
ags_setPalettes(cg->pal, 0, bank << 4, 16);
|
||||
ags_setPalettes(cg->pal, bank << 4, 16);
|
||||
break;
|
||||
case ALCG_PMS8:
|
||||
// Avoid changing the Windows' reserved palette area (0-9, 246-255)
|
||||
if (cg->pms_bank & 1)
|
||||
ags_setPalettes(cg->pal, 10, 10, 6);
|
||||
ags_setPalettes(cg->pal + 10, 10, 6);
|
||||
if (cg->pms_bank & (1 << 15))
|
||||
//ags_setPalettes(cg->pal, 240, 240, 15);
|
||||
ags_setPalettes(cg->pal, 240, 240, 10);
|
||||
ags_setPalettes(cg->pal + 240, 240, 6);
|
||||
for (i = 1; i < 15; i++) {
|
||||
if (cg->pms_bank & (1 << i)) {
|
||||
ags_setPalettes(cg->pal, i * 16, i * 16, 16);
|
||||
ags_setPalettes(cg->pal + i * 16, i * 16, 16);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ALCG_BMP8:
|
||||
ags_setPalettes(cg->pal, 10, 10, 236);
|
||||
ags_setPalettes(cg->pal + 10, 10, 236);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -463,7 +458,7 @@ int cg_load_with_filename(char *fname_utf8, int x, int y) {
|
||||
/* load palette if not extracted */
|
||||
if (cg->depth == 8) {
|
||||
if (GCMD_LOAD_PALETTE(cg_fflg))
|
||||
ags_setPalettes(cg->pal, 10, 10, 236);
|
||||
ags_setPalettes(cg->pal + 10, 10, 236);
|
||||
if (GCMD_SET_PALETTE(cg_fflg))
|
||||
ags_setPaletteToSystem(0, 256);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ typedef struct {
|
||||
|
||||
uint8_t *pic; // extracted pixel data
|
||||
uint8_t *alpha; // extracted alpha data if exists
|
||||
Palette256 *pal; // extracted palette data if exists
|
||||
Color *pal; // 256-color palette if exists
|
||||
|
||||
int vsp_bank; // palette bank for vsp
|
||||
int pms_bank; // palette bank for pms
|
||||
|
||||
+2
-16
@@ -42,9 +42,6 @@
|
||||
#include "ald_manager.h"
|
||||
#include "LittleEndian.h"
|
||||
#include "hacks.h"
|
||||
#if HAVE_UNAME
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
/* 選択 Window OPEN 時 callback */
|
||||
static int cb_sel_init_page = 0;
|
||||
@@ -829,20 +826,9 @@ void commands2F52() {
|
||||
int eNum = getCaliValue();
|
||||
if (eNum <= 0) return;
|
||||
|
||||
#if HAVE_UNAME
|
||||
struct utsname un;
|
||||
char s[256];
|
||||
if (uname(&un) < 0) return;
|
||||
NOTICE("sysname %s nodename %s release %s version %s machine %s",
|
||||
un.sysname, un.nodename, un.release, un.version, un.machine);
|
||||
sprintf(s,"%s %s %s",
|
||||
un.sysname, un.release, un.machine);
|
||||
#else
|
||||
const char *s = CMAKE_SYSTEM_NAME;
|
||||
#endif
|
||||
|
||||
const char *s = SDL_GetPlatform();
|
||||
svar_set(eNum, s);
|
||||
DEBUG_COMMAND("sysGetOsName %d: %s", eNum, s);
|
||||
DEBUG_COMMAND("sysGetOSName %d: %s", eNum, s);
|
||||
}
|
||||
|
||||
void commands2F53() {
|
||||
|
||||
+2
-2
@@ -46,9 +46,9 @@ void commands2F60() {
|
||||
SYSERROR("No DLL initilized");
|
||||
}
|
||||
|
||||
if (dll + type == NULL) goto eexit;
|
||||
if (type < 0 || type >= nact->ain.dllnum) goto eexit;
|
||||
|
||||
if (dll[type].function_num < fnum) goto eexit;
|
||||
if (fnum < 0 || fnum >= dll[type].function_num) goto eexit;
|
||||
|
||||
if (dll[type].function[fnum].entrypoint == NULL) goto eexit;
|
||||
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ void commandIZ() {
|
||||
int x = getCaliValue();
|
||||
int y = getCaliValue();
|
||||
|
||||
ags_setCursorLocation(x, y, TRUE);
|
||||
ags_setCursorLocation(x, y, true, false);
|
||||
DEBUG_COMMAND("IZ %d,%d:", x, y);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -326,7 +326,7 @@ void commandMJ() {
|
||||
mj_param.h = h;
|
||||
mj_param.oldstring = t1;
|
||||
|
||||
ags_setCursorLocation(x, y, FALSE); /* XXX */
|
||||
ags_setCursorLocation(x, y, false, false);
|
||||
menu_inputstring2(&mj_param);
|
||||
if (mj_param.newstring == NULL) return;
|
||||
|
||||
|
||||
+3
-3
@@ -112,9 +112,9 @@ void commandPG() { /* T2 */
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num2; i++) {
|
||||
*var = nact->ags.pal->red[num1 + i]; var++;
|
||||
*var = nact->ags.pal->green[num1 + i]; var++;
|
||||
*var = nact->ags.pal->blue[num1 + i]; var++;
|
||||
*var++ = nact->ags.pal[num1 + i].r;
|
||||
*var++ = nact->ags.pal[num1 + i].g;
|
||||
*var++ = nact->ags.pal[num1 + i].b;
|
||||
}
|
||||
DEBUG_COMMAND("PG %p,%d,%d:", var, num1, num2);
|
||||
}
|
||||
|
||||
+6
-5
@@ -113,11 +113,12 @@ void commandZS() {
|
||||
|
||||
void commandZB() {
|
||||
/* メッセージ文字を太さを設定 */
|
||||
int size = getCaliValue();
|
||||
|
||||
nact->msg.MsgFontBoldSize = size;
|
||||
|
||||
DEBUG_COMMAND("ZB %d:",size);
|
||||
int weight = getCaliValue();
|
||||
|
||||
if (nact->ags.enable_zb)
|
||||
nact->ags.font_weight = weight;
|
||||
|
||||
DEBUG_COMMAND("ZB %d:", weight);
|
||||
}
|
||||
|
||||
void commandZH() {
|
||||
|
||||
@@ -530,6 +530,11 @@ void dbg_onsleep(void) {
|
||||
dbg_impl->onsleep();
|
||||
}
|
||||
|
||||
void dbg_on_palette_change(void) {
|
||||
if (dbg_impl)
|
||||
dbg_impl->on_palette_change();
|
||||
}
|
||||
|
||||
boolean dbg_console_vprintf(int lv, const char *format, va_list ap) {
|
||||
if (!dbg_impl || !dbg_impl->console_output)
|
||||
return false;
|
||||
|
||||
@@ -45,6 +45,7 @@ void dbg_init(const char *symbols_path, boolean use_dap);
|
||||
void dbg_quit(void);
|
||||
void dbg_main(int bp_no);
|
||||
void dbg_onsleep(void);
|
||||
void dbg_on_palette_change(void);
|
||||
uint8_t dbg_handle_breakpoint(int page, int addr);
|
||||
boolean dbg_console_vprintf(int lv, const char *format, va_list ap);
|
||||
void dbg_post_command(void *data);
|
||||
@@ -56,6 +57,7 @@ void dbg_post_command(void *data);
|
||||
#define dbg_quit()
|
||||
#define dbg_main(bp_no)
|
||||
#define dbg_onsleep()
|
||||
#define dbg_on_palette_change()
|
||||
#define dbg_handle_breakpoint(page, addr) BREAKPOINT
|
||||
#define dbg_console_vprintf(lv, format, ap) false
|
||||
#define dbg_post_command(data)
|
||||
|
||||
+34
-2
@@ -51,6 +51,7 @@ static char *symbols_path;
|
||||
static char *src_dir;
|
||||
static struct msgq *queue;
|
||||
static bool break_on_warnings;
|
||||
static uint32_t palette_version;
|
||||
|
||||
cJSON *create_source(const char *name) {
|
||||
cJSON *source = cJSON_CreateObject();
|
||||
@@ -67,7 +68,7 @@ cJSON *create_source(const char *name) {
|
||||
static void send_json(cJSON *json) {
|
||||
static int seq = 0;
|
||||
|
||||
cJSON_AddNumberToObject(json, "seq", seq);
|
||||
cJSON_AddNumberToObject(json, "seq", ++seq);
|
||||
char *str = cJSON_PrintUnformatted(json);
|
||||
printf("Content-Length: %zu\r\n\r\n%s", strlen(str), str);
|
||||
fflush(stdout);
|
||||
@@ -480,6 +481,20 @@ static void cmd_disconnect(cJSON *args, cJSON *resp) {
|
||||
sys_exit(0);
|
||||
}
|
||||
|
||||
static void cmd_palette(cJSON *args, cJSON *resp) {
|
||||
cJSON *body, *palette;
|
||||
cJSON_AddBoolToObject(resp, "success", true);
|
||||
cJSON_AddItemToObjectCS(resp, "body", body = cJSON_CreateObject());
|
||||
cJSON_AddNumberToObject(body, "version", palette_version);
|
||||
cJSON_AddItemToObjectCS(body, "palette", palette = cJSON_CreateArray());
|
||||
for (int i = 0; i < 256; i++) {
|
||||
int val = nact->ags.pal[i].r << 16 |
|
||||
nact->ags.pal[i].g << 8 |
|
||||
nact->ags.pal[i].b;
|
||||
cJSON_AddItemToArray(palette, cJSON_CreateNumber(val));
|
||||
}
|
||||
}
|
||||
|
||||
static boolean handle_request(cJSON *request) {
|
||||
boolean continue_repl = true;
|
||||
|
||||
@@ -536,8 +551,15 @@ static boolean handle_request(cJSON *request) {
|
||||
cmd_setVariable(args, resp);
|
||||
} else if (!strcmp(command->valuestring, "disconnect")) {
|
||||
cmd_disconnect(args, resp);
|
||||
} else if (!strcmp(command->valuestring, "xsystem35.palette")) {
|
||||
cmd_palette(args, resp);
|
||||
} else {
|
||||
fprintf(stderr, "unknown command \"%s\"\n", command->valuestring);
|
||||
cJSON_AddBoolToObject(resp, "success", false);
|
||||
char *buf = malloc(strlen(command->valuestring) + 30);
|
||||
sprintf(buf, "unknown request \"%s\"", command->valuestring);
|
||||
cJSON_AddStringToObject(resp, "message", buf);
|
||||
fprintf(stderr, "%s\n", buf);
|
||||
free(buf);
|
||||
}
|
||||
send_json(resp);
|
||||
return continue_repl;
|
||||
@@ -634,6 +656,15 @@ static void dbg_dap_onsleep(void) {
|
||||
dbg_main(0);
|
||||
}
|
||||
|
||||
static void dbg_dap_on_palette_change(void) {
|
||||
cJSON *event = cJSON_CreateObject(), *body;
|
||||
cJSON_AddStringToObject(event, "type", "event");
|
||||
cJSON_AddStringToObject(event, "event", "xsystem35.paletteChanged");
|
||||
cJSON_AddItemToObjectCS(event, "body", body = cJSON_CreateObject());
|
||||
cJSON_AddNumberToObject(body, "version", ++palette_version);
|
||||
send_json(event);
|
||||
}
|
||||
|
||||
void dbg_post_command(void *data) {
|
||||
msgq_enqueue(queue, data);
|
||||
}
|
||||
@@ -643,5 +674,6 @@ DebuggerImpl dbg_dap_impl = {
|
||||
.quit = dbg_dap_quit,
|
||||
.repl = dbg_dap_repl,
|
||||
.onsleep = dbg_dap_onsleep,
|
||||
.on_palette_change = dbg_dap_on_palette_change,
|
||||
.console_output = emit_output_event,
|
||||
};
|
||||
|
||||
@@ -58,6 +58,7 @@ typedef struct {
|
||||
void (*quit)(void);
|
||||
void (*repl)(int bp_no);
|
||||
void (*onsleep)(void);
|
||||
void (*on_palette_change)(void);
|
||||
void (*console_output)(int lv, const char *output);
|
||||
} DebuggerImpl;
|
||||
|
||||
|
||||
@@ -67,6 +67,8 @@ static bool read_index(int disk, drifiles *d, FILE *fp) {
|
||||
for (int i = 0; i < nr_files; i++) {
|
||||
if (disk != ltbl[i * 3] - 1)
|
||||
continue;
|
||||
if (d->maxno < i)
|
||||
d->maxno = i;
|
||||
d->disk[i] = ltbl[i * 3];
|
||||
int ptr = LittleEndian_getW(ltbl, i * 3 + 1);
|
||||
d->offset[i] = LittleEndian_get3B(ptbl, ptr * 3) << 8;
|
||||
|
||||
@@ -34,6 +34,7 @@ struct _drifiles {
|
||||
mmap_t *mmap[DRIFILEMAX];
|
||||
char *fnames[DRIFILEMAX];
|
||||
int nr_files; // upper limit on how many files could be referenced by this archive
|
||||
int maxno;
|
||||
uint8_t *disk; // file numbers
|
||||
uint32_t *offset; // offsets in file
|
||||
};
|
||||
|
||||
+12
-1
@@ -23,6 +23,11 @@
|
||||
#include <math.h>
|
||||
#include <SDL.h>
|
||||
#include <SDL_ttf.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "win/resources.h"
|
||||
#endif
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
@@ -73,7 +78,7 @@ static FontTable *font_lookup(int size, int type) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void font_select(int type, int size) {
|
||||
void font_select(int type, int size, int weight) {
|
||||
FontTable *tbl;
|
||||
|
||||
if (NULL == (tbl = font_lookup(size, type))) {
|
||||
@@ -89,6 +94,11 @@ void font_select(int type, int size) {
|
||||
if (fp)
|
||||
fs = TTF_OpenFontIndexRW(SDL_RWFromFP(fp, true), true, size, this.face[type]);
|
||||
}
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
SDL_RWops *r = open_resource(this.name[type], "fonts");
|
||||
if (r)
|
||||
fs = TTF_OpenFontIndexRW(r, true, size, this.face[type]);
|
||||
#endif
|
||||
if (!fs)
|
||||
SYSERROR("Cannot open font %s", this.name[type]);
|
||||
@@ -98,6 +108,7 @@ void font_select(int type, int size) {
|
||||
} else {
|
||||
fontset = tbl;
|
||||
}
|
||||
TTF_SetFontStyle(fontset->id, weight > 5 ? TTF_STYLE_BOLD : TTF_STYLE_NORMAL);
|
||||
}
|
||||
|
||||
SDL_Surface *font_get_glyph(const char *str_utf8) {
|
||||
|
||||
+4
-1
@@ -31,11 +31,14 @@
|
||||
/* font の種類 */
|
||||
#define FONTTYPEMAX 2
|
||||
|
||||
#define FONT_WEIGHT_NORMAL 4
|
||||
#define FONT_WEIGHT_BOLD 7
|
||||
|
||||
extern void font_init(void);
|
||||
extern void font_set_name_and_index(int type, const char *name, int index);
|
||||
extern void font_set_antialias(boolean enable);
|
||||
extern boolean font_get_antialias(void);
|
||||
extern void font_select(int type, int size);
|
||||
extern void font_select(int type, int size, int weight);
|
||||
extern struct SDL_Surface *font_get_glyph(const char *str_utf8);
|
||||
extern SDL_Rect font_draw_glyph(int x, int y, const char *str_utf8, uint8_t col);
|
||||
|
||||
|
||||
+4
-4
@@ -28,10 +28,10 @@
|
||||
#include <SDL_rect.h>
|
||||
|
||||
typedef struct {
|
||||
uint8_t red[256];
|
||||
uint8_t green[256];
|
||||
uint8_t blue[256];
|
||||
} Palette256;
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
} Color;
|
||||
|
||||
typedef struct {
|
||||
uint8_t r,g,b;
|
||||
|
||||
+2
-2
@@ -87,7 +87,7 @@ void
|
||||
on_item5_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
nact->ags.mouse_movesw = MOUSE_WARP_SMOOTH;
|
||||
nact->ags.mouse_warp_enabled = true;
|
||||
gtk_menu_popdown(GTK_MENU(menu_window_popup));
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ void
|
||||
on_item6_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
nact->ags.mouse_movesw = MOUSE_WARP_DISABLED;
|
||||
nact->ags.mouse_warp_enabled = false;
|
||||
gtk_menu_popdown(GTK_MENU(menu_window_popup));
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -64,9 +64,8 @@ static void msgget_at_a();
|
||||
|
||||
void msg_init() {
|
||||
/* メッセージフォントの大きさ */
|
||||
msg.MsgFontSize = 16;
|
||||
msg.MsgFontBoldSize = 0;
|
||||
msg.MsgFont = FONT_GOTHIC;
|
||||
msg.MsgFontSize = 16;
|
||||
msg.MsgFont = FONT_GOTHIC;
|
||||
|
||||
/* 各種色 */
|
||||
msg.MsgFontColor = 255;
|
||||
@@ -141,7 +140,8 @@ void msg_putMessage(const char *m) {
|
||||
// fprintf(stdout, "x=%d, y = %d, msg=%s\n", msgcur.x,msgcur.y,msg);
|
||||
if (!msg.mg_dspMsg) return;
|
||||
|
||||
ags_setFont(msg.MsgFont, msg.MsgFontSize);
|
||||
ags_setFontWithWeight(msg.MsgFont, msg.MsgFontSize, nact->ags.font_weight);
|
||||
|
||||
switch(msgDecorateType) {
|
||||
case 0:
|
||||
default:
|
||||
|
||||
@@ -44,7 +44,6 @@ extern void msg_mg6_command(int cmd);
|
||||
struct __message {
|
||||
/* メッセージフォントの大きさ */
|
||||
int MsgFontSize;
|
||||
int MsgFontBoldSize;
|
||||
int MsgFont;
|
||||
|
||||
/* 各種色 */
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ int midi_init(mididevice_t *midi) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void midi_set_devicename(char *name) {
|
||||
void midi_set_devicename(const char *name) {
|
||||
if (dev) free(dev);
|
||||
if (0 == strcmp("none", name)) dev = NULL;
|
||||
else dev = strdup(name);
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ struct mididevice {
|
||||
};
|
||||
|
||||
extern int midi_init(mididevice_t *);
|
||||
extern void midi_set_devicename(char *);
|
||||
extern void midi_set_devicename(const char *);
|
||||
extern void midi_set_output_device(int mode);
|
||||
|
||||
#endif /* __MIDI_H__ */
|
||||
|
||||
+4
-1
@@ -89,10 +89,13 @@ static int midi_start(int no, int loop, char *data, int datalen) {
|
||||
|
||||
SDL_RWops *rwops = SDL_RWFromConstMem(data, datalen);
|
||||
mix_music = Mix_LoadMUSType_RW(rwops, MUS_MID, SDL_TRUE /* freesrc */);
|
||||
if (!mix_music)
|
||||
if (!mix_music) {
|
||||
WARNING("Cannot load MIDI: %s", SDL_GetError());
|
||||
return NG;
|
||||
}
|
||||
|
||||
if (Mix_PlayMusic(mix_music, loop ? loop : -1) != 0) {
|
||||
WARNING("Cannot play MIDI: %s", SDL_GetError());
|
||||
Mix_FreeMusic(mix_music);
|
||||
mix_music = NULL;
|
||||
return NG;
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
|
||||
static char *dev = CDROM_DEVICE;
|
||||
|
||||
void muscd_set_devicename(char *name) {
|
||||
void muscd_set_devicename(const char *name) {
|
||||
if (0 == strcmp("none", name)) dev = NULL;
|
||||
else dev = strdup(name);
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
#include "portab.h"
|
||||
#include "ald_manager.h"
|
||||
|
||||
void muscd_set_devicename(char *);
|
||||
void muscd_set_devicename(const char *);
|
||||
int muscd_init(void);
|
||||
int muscd_init_bgm(DRIFILETYPE type, int base_no);
|
||||
int muscd_exit(void);
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
* static methods
|
||||
*/
|
||||
static pms_header *extract_header(uint8_t *b);
|
||||
static void getpal(Palette256 *pal, uint8_t *b);
|
||||
static void extract_8bit(pms_header *pms, uint8_t *pic, uint8_t *b);
|
||||
static void extract_16bit(pms_header *pms, uint16_t *pic, uint8_t *b);
|
||||
|
||||
@@ -75,17 +74,16 @@ static pms_header *extract_header(uint8_t *b) {
|
||||
|
||||
/*
|
||||
* Get palette from raw data
|
||||
* pal: palette to be stored
|
||||
* b : raw data (pointer to palette)
|
||||
*/
|
||||
static void getpal(Palette256 *pal, uint8_t *b) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
pal->red[i] = *b++;
|
||||
pal->green[i] = *b++;
|
||||
pal->blue[i] = *b++;
|
||||
static Color *getpal(uint8_t *b) {
|
||||
Color *pal = malloc(sizeof(Color) * 256);
|
||||
for (int i = 0; i < 256; i++) {
|
||||
pal[i].r = *b++;
|
||||
pal[i].g = *b++;
|
||||
pal[i].b = *b++;
|
||||
}
|
||||
return pal;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -227,8 +225,7 @@ cgdata *pms256_extract(uint8_t *data) {
|
||||
cgdata *cg = calloc(1, sizeof(cgdata));
|
||||
pms_header *pms = extract_header(data);
|
||||
|
||||
cg->pal = malloc(sizeof(Palette256));
|
||||
getpal(cg->pal, data + pms->pmsPp);
|
||||
cg->pal = getpal(data + pms->pmsPp);
|
||||
|
||||
/* +10: margin for broken cg */
|
||||
cg->pic = malloc(sizeof(uint8_t) * ((pms->pmsXW + 10) * (pms->pmsYW + 10)));
|
||||
|
||||
+28
-39
@@ -28,12 +28,6 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include "win/resources.h"
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#include "portab.h"
|
||||
#include "profile.h"
|
||||
@@ -41,7 +35,6 @@
|
||||
|
||||
#define RC_NAME ".xsys35rc"
|
||||
#define RC_LINE_CHARS_MAX 256
|
||||
#define REGKEY_PROFILE XSYSTEM35_REGKEY "\\profile"
|
||||
|
||||
struct profile_kv {
|
||||
char *name;
|
||||
@@ -138,39 +131,14 @@ static int load_rc_file(const char *profile_path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
static void load_profile_from_registry(HKEY rootKey)
|
||||
{
|
||||
HKEY hKey;
|
||||
LSTATUS err = RegOpenKeyEx(rootKey, REGKEY_PROFILE, 0, KEY_QUERY_VALUE, &hKey);
|
||||
if (err != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
for (DWORD index = 0;; index++) {
|
||||
char name[64];
|
||||
BYTE value[RC_LINE_CHARS_MAX];
|
||||
DWORD name_size = sizeof(name);
|
||||
DWORD value_size = sizeof(value);
|
||||
DWORD type;
|
||||
err = RegEnumValue(hKey, index, name, &name_size, NULL, &type, value, &value_size);
|
||||
if (err != ERROR_SUCCESS)
|
||||
break;
|
||||
if (type != REG_SZ)
|
||||
continue;
|
||||
insert_profile(name, value);
|
||||
}
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
int load_profile(void)
|
||||
{
|
||||
char *home_dir = getenv("HOME");
|
||||
#ifdef _WIN32
|
||||
load_profile_from_registry(HKEY_LOCAL_MACHINE);
|
||||
load_profile_from_registry(HKEY_CURRENT_USER);
|
||||
#endif // _WIN32
|
||||
|
||||
char *home_dir;
|
||||
if ((home_dir = getenv("HOME"))) {
|
||||
if (!home_dir)
|
||||
home_dir = getenv("USERPROFILE");
|
||||
#endif
|
||||
if (home_dir) {
|
||||
char profile_path[PATH_MAX];
|
||||
sprintf(profile_path, "%s/%s", home_dir, RC_NAME);
|
||||
load_rc_file(profile_path);
|
||||
@@ -178,11 +146,32 @@ int load_profile(void)
|
||||
return load_rc_file(RC_NAME);
|
||||
}
|
||||
|
||||
char *get_profile(const char *name)
|
||||
{
|
||||
const char *get_profile(const char *name) {
|
||||
struct profile_kv *kv;
|
||||
|
||||
if (!(kv = check_profile(name)))
|
||||
return NULL;
|
||||
return kv->value;
|
||||
}
|
||||
|
||||
bool get_boolean_profile(const char *name, bool *out) {
|
||||
const char *value = get_profile(name);
|
||||
if (!value)
|
||||
return false;
|
||||
const char *yes_values[] = {"yes", "true", "on", "1", NULL};
|
||||
const char *no_values[] = {"no", "false", "off", "0", NULL};
|
||||
for (int i = 0; yes_values[i]; i++) {
|
||||
if (!strcasecmp(value, yes_values[i])) {
|
||||
*out = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (int i = 0; no_values[i]; i++) {
|
||||
if (!strcasecmp(value, no_values[i])) {
|
||||
*out = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
WARNING("invalid profile value for %s: \"%s\"\n", name, value);
|
||||
return false;
|
||||
}
|
||||
|
||||
+4
-1
@@ -25,7 +25,10 @@
|
||||
#ifndef __PROFILE_H__
|
||||
#define __PROFILE_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
int load_profile(void);
|
||||
char *get_profile(const char *name);
|
||||
const char *get_profile(const char *name);
|
||||
bool get_boolean_profile(const char *name, bool *out);
|
||||
|
||||
#endif /* __PROFILE_H__ */
|
||||
|
||||
+2
-1
@@ -55,7 +55,7 @@ extern void sdl_updateAll(MyRectangle *view_rect);
|
||||
extern void sdl_updateScreen(void);
|
||||
|
||||
/* パレット関係 */
|
||||
extern void sdl_setPalette(Palette256 *pal, int first, int count);
|
||||
extern void sdl_setPalette(Color *pal, int first, int count);
|
||||
|
||||
/* 描画関係 */
|
||||
extern void sdl_drawRectangle(int x, int y, int w, int h, uint8_t c);
|
||||
@@ -95,6 +95,7 @@ void sdl_effect_finish(struct sdl_effect *eff);
|
||||
/* key/pointer 関係 */
|
||||
extern void sdl_setJoyDeviceIndex(int index);
|
||||
extern void sdl_setCursorLocation(int x, int y);
|
||||
extern void sdl_setCursorInternalLocation(int x, int y);
|
||||
extern void sdl_setCursorType(int type);
|
||||
extern boolean sdl_cursorNew(uint8_t* data, int no, CursorImage *cursorImage, TCursorDirEntry *cursordirentry);
|
||||
extern int sdl_getKeyInfo();
|
||||
|
||||
+7
-10
@@ -118,11 +118,11 @@ void sdl_updateAll(MyRectangle *view_rect) {
|
||||
}
|
||||
|
||||
/* Color の複数個指定 */
|
||||
void sdl_setPalette(Palette256 *pal, int first, int count) {
|
||||
void sdl_setPalette(Color *pal, int first, int count) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
sdl_col[first + i].r = pal->red [first + i];
|
||||
sdl_col[first + i].g = pal->green[first + i];
|
||||
sdl_col[first + i].b = pal->blue [first + i];
|
||||
sdl_col[first + i].r = pal[first + i].r;
|
||||
sdl_col[first + i].g = pal[first + i].g;
|
||||
sdl_col[first + i].b = pal[first + i].b;
|
||||
}
|
||||
if (sdl_dib->format->BitsPerPixel == 8)
|
||||
SDL_SetPaletteColors(sdl_dib->format->palette, &sdl_col[first], first, count);
|
||||
@@ -227,13 +227,10 @@ void sdl_drawImage8_fromData(cgdata *cg, int dx, int dy, int sprite_color) {
|
||||
|
||||
if (sdl_dib->format->BitsPerPixel > 8 && cg->pal) {
|
||||
SDL_Color *c = s->format->palette->colors;
|
||||
uint8_t *r = cg->pal->red;
|
||||
uint8_t *g = cg->pal->green;
|
||||
uint8_t *b = cg->pal->blue;
|
||||
for (int i = 0; i < 256; i++) {
|
||||
c->r = *(r++);
|
||||
c->g = *(g++);
|
||||
c->b = *(b++);
|
||||
c->r = cg->pal[i].r;
|
||||
c->g = cg->pal[i].g;
|
||||
c->b = cg->pal[i].b;
|
||||
c++;
|
||||
}
|
||||
} else {
|
||||
|
||||
+27
-11
@@ -223,6 +223,12 @@ void send_agsevent(enum agsevent_type type, int code) {
|
||||
nact->ags.eventcb(&agse); // Async in emscripten
|
||||
}
|
||||
|
||||
void sdl_setCursorInternalLocation(int x, int y) {
|
||||
mousex = x;
|
||||
mousey = y;
|
||||
send_agsevent(AGSEVENT_MOUSE_MOTION, 0);
|
||||
}
|
||||
|
||||
// Improves map navigation of Rance4 v2. See also the function comment of
|
||||
// rance4_Y3_IM_hack() in cmdy.c.
|
||||
static void rance4v2_hack(void) {
|
||||
@@ -274,9 +280,7 @@ void sdl_handle_event(SDL_Event *e) {
|
||||
}
|
||||
break;
|
||||
case SDL_MOUSEMOTION:
|
||||
mousex = e->motion.x;
|
||||
mousey = e->motion.y;
|
||||
send_agsevent(AGSEVENT_MOUSE_MOTION, 0);
|
||||
sdl_setCursorInternalLocation(e->motion.x, e->motion.y);
|
||||
break;
|
||||
|
||||
case SDL_MOUSEWHEEL:
|
||||
@@ -381,14 +385,26 @@ void sdl_handle_event(SDL_Event *e) {
|
||||
|
||||
case SDL_JOYBUTTONDOWN:
|
||||
case SDL_JOYBUTTONUP:
|
||||
if (e->jbutton.button < 4) {
|
||||
int i = 1 << (e->jbutton.button+4);
|
||||
if (e->jbutton.state == SDL_PRESSED)
|
||||
joyinfo |= i;
|
||||
else
|
||||
joyinfo &= ~i;
|
||||
} else {
|
||||
if (e->jbutton.state == SDL_RELEASED) {
|
||||
{
|
||||
int mask = 0;
|
||||
switch (e->jbutton.button) {
|
||||
case 0: case 1: case 2: case 3:
|
||||
mask = 1 << (e->jbutton.button + 4);
|
||||
break;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
// Gamepads known to browsers get a "standard" mapping where D-pad
|
||||
// keys are mapped to buttons 12-15.
|
||||
case 12: mask = SYS35KEY_UP; break;
|
||||
case 13: mask = SYS35KEY_DOWN; break;
|
||||
case 14: mask = SYS35KEY_LEFT; break;
|
||||
case 15: mask = SYS35KEY_RIGHT; break;
|
||||
#endif
|
||||
}
|
||||
if (mask) {
|
||||
if (e->jbutton.state == SDL_PRESSED)
|
||||
joyinfo |= mask;
|
||||
else
|
||||
joyinfo &= ~mask;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
+1
-3
@@ -41,7 +41,6 @@ static void makeDIB(int width, int height, int depth);
|
||||
|
||||
struct sdl_private_data *sdl_videodev;
|
||||
static int joy_device_index = -1;
|
||||
static boolean integer_scaling = FALSE;
|
||||
|
||||
static SDL_Joystick *js;
|
||||
|
||||
@@ -152,7 +151,6 @@ static void window_init(const char *render_driver) {
|
||||
flags);
|
||||
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
|
||||
SDL_SetRenderDrawColor(sdl_renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||
SDL_RenderSetIntegerScale(sdl_renderer, integer_scaling);
|
||||
}
|
||||
|
||||
static void makeDIB(int width, int height, int depth) {
|
||||
@@ -274,7 +272,7 @@ void sdl_setJoyDeviceIndex(int index) {
|
||||
}
|
||||
|
||||
void sdl_setIntegerScaling(boolean enable) {
|
||||
integer_scaling = enable;
|
||||
SDL_RenderSetIntegerScale(sdl_renderer, enable);
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
|
||||
+12
-14
@@ -301,7 +301,7 @@ static void init_selwindow() {
|
||||
NOTICE("frameType is Default");
|
||||
break;
|
||||
}
|
||||
ags_setFont(FONT_GOTHIC, sel.MsgFontSize);
|
||||
ags_setFontWithWeight(FONT_GOTHIC, sel.MsgFontSize, nact->ags.font_weight);
|
||||
for (i = 0; i < regnum; i++) {
|
||||
DEBUG_MESSAGE("%d:%s\n", i +1, elm[i]);
|
||||
ags_drawString(r.x +2, r.y + i * (sel.MsgFontSize +2) +1, elm[i], sel.MsgFontColor);
|
||||
@@ -309,28 +309,26 @@ static void init_selwindow() {
|
||||
ags_updateArea(saveArea.x, saveArea.y, saveArea.w, saveArea.h);
|
||||
|
||||
/* マウスカーソルの自動移動 */
|
||||
int x = r.x + r.w * MOUSE_INIT_X_RATIO/100;
|
||||
if (default_element == 0) {
|
||||
MyPoint p;
|
||||
sys_getMouseInfo(&p, TRUE);
|
||||
if (p.y < r.y) {
|
||||
ags_setCursorLocation(r.x + r.w * MOUSE_INIT_X_RATIO/100,
|
||||
r.y + (sel.MsgFontSize +2) * MOUSE_INIT_Y_RATIO/100,
|
||||
TRUE);
|
||||
int y = r.y + (sel.MsgFontSize +2) * MOUSE_INIT_Y_RATIO/100;
|
||||
ags_setCursorLocation(x, y, true, true);
|
||||
} else if (p.y > (r.y + r.h)) {
|
||||
ags_setCursorLocation(r.x + r.w * MOUSE_INIT_X_RATIO/100,
|
||||
r.y + (sel.MsgFontSize +2) * regnum * MOUSE_INIT_Y_RATIO/100,
|
||||
TRUE);
|
||||
int y = r.y + (sel.MsgFontSize +2) * regnum * MOUSE_INIT_Y_RATIO/100;
|
||||
ags_setCursorLocation(x, y, true, true);
|
||||
} else {
|
||||
ags_setCursorLocation(r.x + r.w * MOUSE_INIT_X_RATIO/100,
|
||||
p.y * MOUSE_INIT_Y_RATIO/100,
|
||||
TRUE);
|
||||
int y = p.y * MOUSE_INIT_Y_RATIO/100;
|
||||
ags_setCursorLocation(x, y, true, true);
|
||||
}
|
||||
} else if (default_element < regnum) {
|
||||
ags_setCursorLocation(r.x + r.w * MOUSE_INIT_X_RATIO/100,
|
||||
r.y + (sel.MsgFontSize +2) * default_element * MOUSE_INIT_Y_RATIO/100, TRUE);
|
||||
int y = r.y + (sel.MsgFontSize +2) * default_element * MOUSE_INIT_Y_RATIO/100;
|
||||
ags_setCursorLocation(x, y, true, true);
|
||||
} else if (default_element < 1000) {
|
||||
ags_setCursorLocation(r.x + r.w * MOUSE_INIT_X_RATIO/100,
|
||||
r.y + (sel.MsgFontSize +2) * regnum * MOUSE_INIT_Y_RATIO/100, TRUE);
|
||||
int y = r.y + (sel.MsgFontSize +2) * regnum * MOUSE_INIT_Y_RATIO/100;
|
||||
ags_setCursorLocation(x, y, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ struct _selection {
|
||||
int FrameCgNoBot;
|
||||
int Framedot;
|
||||
|
||||
/* メッセージフォントの大きさ */
|
||||
/* メッセージフォントの大きさ */
|
||||
int MsgFontSize;
|
||||
|
||||
/* 各種色 */
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
* static methods
|
||||
*/
|
||||
static vsp_header *extract_header(uint8_t *b);
|
||||
static void getpal(Palette256 *pal, uint8_t *b);
|
||||
static void extract(vsp_header *vsp, uint8_t *pic, uint8_t *b);
|
||||
|
||||
/*
|
||||
@@ -66,15 +65,16 @@ static vsp_header *extract_header(uint8_t *b) {
|
||||
|
||||
/*
|
||||
* Get palette from raw data
|
||||
* pal: palette to be stored
|
||||
* b : raw data (pointer to palette)
|
||||
*/
|
||||
static void getpal(Palette256 *pal, uint8_t *b) {
|
||||
static Color *getpal(uint8_t *b) {
|
||||
Color *pal = malloc(sizeof(Color) * 256);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
pal->blue[i] = b[i * 3 + 0] * 17;
|
||||
pal->red[i] = b[i * 3 + 1] * 17;
|
||||
pal->green[i] = b[i * 3 + 2] * 17;
|
||||
pal[i].b = b[i * 3 + 0] * 17;
|
||||
pal[i].r = b[i * 3 + 1] * 17;
|
||||
pal[i].g = b[i * 3 + 2] * 17;
|
||||
}
|
||||
return pal;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -196,8 +196,7 @@ cgdata *vsp_extract(uint8_t *data) {
|
||||
cgdata *cg = calloc(1, sizeof(cgdata));
|
||||
vsp_header *vsp = extract_header(data);
|
||||
|
||||
cg->pal = malloc(sizeof(Palette256));
|
||||
getpal(cg->pal, data + vsp->vspPp);
|
||||
cg->pal = getpal(data + vsp->vspPp);
|
||||
|
||||
/* +10: margin for broken cg */
|
||||
cg->pic = malloc(sizeof(uint8_t) * ((vsp->vspXW * 8 + 10) * (vsp->vspYW + 10)));
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#undef min
|
||||
#undef max
|
||||
#include <SDL_syswm.h>
|
||||
@@ -25,8 +24,6 @@
|
||||
#include "sdl_private.h"
|
||||
#include "resources.h"
|
||||
|
||||
#define REGVAL_RECENT_FOLDER "RecentFolder"
|
||||
|
||||
static HWND get_hwnd(SDL_Window *window) {
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION(&info.version);
|
||||
@@ -34,49 +31,6 @@ static HWND get_hwnd(SDL_Window *window) {
|
||||
return info.info.win.window;
|
||||
}
|
||||
|
||||
static int CALLBACK select_game_callback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) {
|
||||
if (uMsg == BFFM_INITIALIZED)
|
||||
SendMessage(hwnd, BFFM_SETSELECTION, (WPARAM)TRUE, lpData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean current_folder_has_ald(void) {
|
||||
WIN32_FIND_DATA find_data;
|
||||
HANDLE hFind = FindFirstFile("*.ALD", &find_data);
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
FindClose(hFind);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
boolean select_game_folder(void) {
|
||||
char title[256];
|
||||
LoadString(GetModuleHandle(NULL), IDS_CHOOSE_GAME_FOLDER, title, sizeof(title));
|
||||
|
||||
char path[MAX_PATH] = "";
|
||||
DWORD value_size = sizeof(path);
|
||||
RegGetValue(HKEY_CURRENT_USER, XSYSTEM35_REGKEY, REGVAL_RECENT_FOLDER,
|
||||
RRF_RT_REG_SZ, NULL, path, &value_size);
|
||||
|
||||
BROWSEINFO bi = {
|
||||
.lpszTitle = title,
|
||||
.ulFlags = BIF_RETURNONLYFSDIRS,
|
||||
.lpfn = &select_game_callback,
|
||||
.lParam = (LPARAM)path,
|
||||
};
|
||||
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
|
||||
if (!pidl)
|
||||
return FALSE;
|
||||
SHGetPathFromIDList(pidl, path);
|
||||
CoTaskMemFree(pidl);
|
||||
if (!SetCurrentDirectory(path))
|
||||
return FALSE;
|
||||
|
||||
RegSetKeyValue(HKEY_CURRENT_USER, XSYSTEM35_REGKEY, REGVAL_RECENT_FOLDER,
|
||||
REG_SZ, path, strlen(path) + 1);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK text_dialog_proc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static INPUTSTRING_PARAM *p;
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
struct inputstring_param;
|
||||
struct inputnum_param;
|
||||
|
||||
boolean current_folder_has_ald(void);
|
||||
boolean select_game_folder(void);
|
||||
boolean input_string(struct inputstring_param *p);
|
||||
boolean input_number(struct inputnum_param *p);
|
||||
|
||||
|
||||
+15
-8
@@ -59,7 +59,7 @@ static void saveScreenshot(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void toggle_mouse_warp_mode(void) {
|
||||
static bool toggle_menu_item(UINT id, bool *checked_out) {
|
||||
HWND hwnd = get_hwnd(sdl_window);
|
||||
HMENU hmenu = GetMenu(hwnd);
|
||||
|
||||
@@ -67,16 +67,17 @@ static void toggle_mouse_warp_mode(void) {
|
||||
.cbSize = sizeof(MENUITEMINFO),
|
||||
.fMask = MIIM_STATE,
|
||||
};
|
||||
if (!GetMenuItemInfo(hmenu, ID_OPTION_MOUSE_MOVE, false, &menuitem))
|
||||
return;
|
||||
if (!GetMenuItemInfo(hmenu, id, false, &menuitem))
|
||||
return false;
|
||||
|
||||
if (menuitem.fState & MFS_CHECKED) {
|
||||
nact->ags.mouse_movesw = MOUSE_WARP_DISABLED;
|
||||
CheckMenuItem(hmenu, ID_OPTION_MOUSE_MOVE, MF_BYCOMMAND | MFS_UNCHECKED);
|
||||
CheckMenuItem(hmenu, id, MF_BYCOMMAND | MFS_UNCHECKED);
|
||||
*checked_out = false;
|
||||
} else {
|
||||
nact->ags.mouse_movesw = MOUSE_WARP_SMOOTH;
|
||||
CheckMenuItem(hmenu, ID_OPTION_MOUSE_MOVE, MF_BYCOMMAND | MFS_CHECKED);
|
||||
CheckMenuItem(hmenu, id, MF_BYCOMMAND | MFS_CHECKED);
|
||||
*checked_out = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void win_menu_init(void) {
|
||||
@@ -90,6 +91,7 @@ void win_menu_init(void) {
|
||||
}
|
||||
|
||||
void win_menu_onsyswmevent(SDL_SysWMmsg* msg) {
|
||||
bool checked;
|
||||
switch (msg->msg.win.msg) {
|
||||
case WM_COMMAND:
|
||||
switch (msg->msg.win.wParam) {
|
||||
@@ -108,8 +110,13 @@ void win_menu_onsyswmevent(SDL_SysWMmsg* msg) {
|
||||
case ID_SCREEN_FULL:
|
||||
sdl_setFullscreen(TRUE);
|
||||
break;
|
||||
case ID_SCREEN_INTEGER_SCALING:
|
||||
if (toggle_menu_item(ID_SCREEN_INTEGER_SCALING, &checked))
|
||||
sdl_setIntegerScaling(checked);
|
||||
break;
|
||||
case ID_OPTION_MOUSE_MOVE:
|
||||
toggle_mouse_warp_mode();
|
||||
if (toggle_menu_item(ID_OPTION_MOUSE_MOVE, &checked))
|
||||
nact->ags.mouse_warp_enabled = checked;
|
||||
break;
|
||||
case ID_MSGSKIP:
|
||||
msgskip_activate(!msgskip_isActivated());
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2024 <KichikuouChrome@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <SDL_rwops.h>
|
||||
#include "resources.h"
|
||||
|
||||
SDL_RWops *open_resource(const char* name, const char* type) {
|
||||
HINSTANCE hInst = GetModuleHandle(NULL);
|
||||
HRSRC hRes = FindResource(hInst, name, type);
|
||||
if (!hRes) return NULL;
|
||||
HGLOBAL hGlobal = LoadResource(hInst, hRes);
|
||||
if (!hGlobal) return NULL;
|
||||
return SDL_RWFromConstMem(LockResource(hGlobal), SizeofResource(hInst, hRes));
|
||||
}
|
||||
+11
-9
@@ -19,8 +19,6 @@
|
||||
#ifndef __RESOURCES_H__
|
||||
#define __RESOURCES_H__
|
||||
|
||||
#define XSYSTEM35_REGKEY "Software\\Kichikuou\\xsystem35"
|
||||
|
||||
#define IDR_MENU1 101
|
||||
#define IDD_DIALOG1 103
|
||||
#define IDC_TEXT 104
|
||||
@@ -28,12 +26,16 @@
|
||||
|
||||
#define IDS_CHOOSE_GAME_FOLDER 1001
|
||||
|
||||
#define ID_SCREENSHOT 40001
|
||||
#define ID_RESTART 40002
|
||||
#define ID_EXIT 40003
|
||||
#define ID_SCREEN_WINDOW 40011
|
||||
#define ID_SCREEN_FULL 40012
|
||||
#define ID_OPTION_MOUSE_MOVE 40021
|
||||
#define ID_MSGSKIP 40030
|
||||
#define ID_SCREENSHOT 40001
|
||||
#define ID_RESTART 40002
|
||||
#define ID_EXIT 40003
|
||||
#define ID_SCREEN_WINDOW 40011
|
||||
#define ID_SCREEN_FULL 40012
|
||||
#define ID_SCREEN_INTEGER_SCALING 40013
|
||||
#define ID_OPTION_MOUSE_MOVE 40021
|
||||
#define ID_MSGSKIP 40030
|
||||
|
||||
struct SDL_RWops;
|
||||
struct SDL_RWops *open_resource(const char* name, const char* type);
|
||||
|
||||
#endif /* __RESOURCES_H__ */
|
||||
|
||||
@@ -4,6 +4,14 @@
|
||||
|
||||
100 ICON DISCARDABLE "xsystem35.ico"
|
||||
|
||||
// Note for game translators:
|
||||
// Rather than replacing these, use the "ttfont_gothic" and "ttfont_mincho"
|
||||
// options in .xsys35rc. That will allow your translated game run on other
|
||||
// other platforms, such as Android and Web.
|
||||
MTLc3m.ttf FONTS DISCARDABLE "../../fonts/MTLc3m.ttf"
|
||||
mincho.otf FONTS DISCARDABLE "../../fonts/mincho.otf"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
|
||||
|
||||
@@ -19,6 +27,7 @@ IDR_MENU1 MENU DISCARDABLE
|
||||
{
|
||||
MENUITEM "Window", ID_SCREEN_WINDOW
|
||||
MENUITEM "Fullscreen", ID_SCREEN_FULL
|
||||
MENUITEM "Integer Scaling", ID_SCREEN_INTEGER_SCALING
|
||||
}
|
||||
POPUP "Option"
|
||||
{
|
||||
@@ -57,6 +66,7 @@ IDR_MENU1 MENU DISCARDABLE
|
||||
{
|
||||
MENUITEM "ウィンドウ", ID_SCREEN_WINDOW
|
||||
MENUITEM "フルスクリーン", ID_SCREEN_FULL
|
||||
MENUITEM "整数倍スケーリング", ID_SCREEN_INTEGER_SCALING
|
||||
}
|
||||
POPUP "オプション"
|
||||
{
|
||||
|
||||
+31
-31
@@ -80,7 +80,7 @@ static void sys35_remove();
|
||||
static void sys35_ParseOption(int *argc, char **argv);
|
||||
static void check_profile();
|
||||
|
||||
static char *render_driver = NULL;
|
||||
static const char *render_driver = NULL;
|
||||
|
||||
/* for debugging */
|
||||
static int debuglv = DEBUGLEVEL;
|
||||
@@ -93,11 +93,12 @@ enum {
|
||||
static int audio_buffer_size = 0;
|
||||
|
||||
/* font name from rcfile */
|
||||
static char *fontname_tt[FONTTYPEMAX] = {DEFAULT_GOTHIC_TTF, DEFAULT_MINCHO_TTF};
|
||||
static const char *fontname_tt[FONTTYPEMAX] = {DEFAULT_GOTHIC_TTF, DEFAULT_MINCHO_TTF};
|
||||
static char fontface[FONTTYPEMAX];
|
||||
|
||||
static boolean font_noantialias;
|
||||
|
||||
static bool enable_zb = false;
|
||||
static bool integer_scaling = false;
|
||||
/* fullscreen on from command line */
|
||||
static boolean fs_on;
|
||||
|
||||
@@ -137,12 +138,15 @@ static void sys35_usage(boolean verbose) {
|
||||
puts(" -ttfont_gothic : set TrueType font for mincho");
|
||||
|
||||
#ifdef DEBUG
|
||||
puts(" -debuglv # : debug level");
|
||||
puts(" -debuglv # : logging level");
|
||||
puts(" : 1: warings");
|
||||
puts(" : 2: unimplemented commands");
|
||||
puts(" : 5: command trace");
|
||||
puts(" : 6: message trace");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
puts(" -debug : start with debugger");
|
||||
#endif
|
||||
puts(" -noantialias : never use antialiased string");
|
||||
puts(" -fullscreen : start with fullscreen");
|
||||
puts(" -integerscale : use integer scaling when resizing");
|
||||
@@ -210,7 +214,7 @@ static void sys35_init() {
|
||||
|
||||
v_init();
|
||||
|
||||
ags_init(render_driver);
|
||||
ags_init(render_driver, enable_zb);
|
||||
|
||||
for (i = 0; i < FONTTYPEMAX; i++)
|
||||
font_set_name_and_index(i, fontname_tt[i], fontface[i]);
|
||||
@@ -293,6 +297,8 @@ static void sys35_ParseOption(int *argc, char **argv) {
|
||||
fs_on = TRUE;
|
||||
} else if (0 == strcmp(argv[i], "-noantialias")) {
|
||||
font_noantialias = TRUE;
|
||||
} else if (0 == strcmp(argv[i], "-enable_zb")) {
|
||||
enable_zb = TRUE;
|
||||
} else if (0 == strcmp(argv[i], "-ttfont_gothic")) {
|
||||
if (argv[i + 1] != NULL) {
|
||||
fontname_tt[FONT_GOTHIC] = argv[i + 1];
|
||||
@@ -311,7 +317,7 @@ static void sys35_ParseOption(int *argc, char **argv) {
|
||||
puts(VERSION);
|
||||
exit(0);
|
||||
} else if (0 == strcmp(argv[i], "-integerscale")) {
|
||||
sdl_setIntegerScaling(TRUE);
|
||||
integer_scaling = true;
|
||||
} else if (0 == strcmp(argv[i], "-game")) {
|
||||
if (argv[i + 1] != NULL) {
|
||||
enable_hack_by_gameid(argv[i + 1]);
|
||||
@@ -325,7 +331,7 @@ static void sys35_ParseOption(int *argc, char **argv) {
|
||||
}
|
||||
|
||||
static void check_profile() {
|
||||
char *param;
|
||||
const char *param;
|
||||
|
||||
/* ゴシックフォント(TT)の設定 */
|
||||
param = get_profile("ttfont_gothic");
|
||||
@@ -348,12 +354,14 @@ static void check_profile() {
|
||||
fontface[FONT_MINCHO] = *param - '0';
|
||||
}
|
||||
/* Font antialiasing */
|
||||
param = get_profile("antialias");
|
||||
if (param) {
|
||||
if (0 == strcmp(param, "No")) {
|
||||
font_noantialias = TRUE;
|
||||
}
|
||||
bool antialias;
|
||||
if (get_boolean_profile("antialias", &antialias)) {
|
||||
font_noantialias = !antialias;
|
||||
}
|
||||
|
||||
/* Enable ZB command (font weight) */
|
||||
get_boolean_profile("enable_zb", &enable_zb);
|
||||
|
||||
/* Audio buffer size */
|
||||
param = get_profile("audio_buffer_size");
|
||||
if (param) {
|
||||
@@ -391,19 +399,11 @@ static void check_profile() {
|
||||
midi_set_output_device(*param | subdev);
|
||||
}
|
||||
/* disable image cursor */
|
||||
param = get_profile("no_imagecursor");
|
||||
if (param) {
|
||||
if (0 == strcmp(param, "Yes")) {
|
||||
nact->ags.noimagecursor = TRUE;
|
||||
}
|
||||
}
|
||||
get_boolean_profile("no_imagecursor", &nact->ags.noimagecursor);
|
||||
|
||||
/* enable integer scaling */
|
||||
param = get_profile("integerscale");
|
||||
if (param) {
|
||||
if (0 == strcmp(param, "Yes")) {
|
||||
sdl_setIntegerScaling(TRUE);
|
||||
}
|
||||
}
|
||||
get_boolean_profile("integerscale", &integer_scaling);
|
||||
|
||||
/* enable game-specific hacks */
|
||||
param = get_profile("game");
|
||||
if (param) {
|
||||
@@ -476,12 +476,6 @@ int main(int argc, char **argv) {
|
||||
if (strcmp(argv[1], "-gamedir") == 0)
|
||||
chdir(argv[2]);
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
if (argc == 1 && !current_folder_has_ald()) {
|
||||
if (!select_game_folder())
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
load_profile();
|
||||
check_profile();
|
||||
@@ -509,6 +503,8 @@ int main(int argc, char **argv) {
|
||||
#endif
|
||||
|
||||
sys35_init();
|
||||
if (integer_scaling)
|
||||
sdl_setIntegerScaling(true);
|
||||
|
||||
#ifdef ENABLE_GTK
|
||||
gtk_init(&argc, &argv);
|
||||
@@ -517,9 +513,13 @@ int main(int argc, char **argv) {
|
||||
menu_init();
|
||||
|
||||
if (debugger_mode != DEBUGGER_DISABLED) {
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
char symbols_path[500];
|
||||
snprintf(symbols_path, sizeof(symbols_path), "%s.symbols", nact->files.game_fname[DRIFILE_SCO][0]);
|
||||
dbg_init(symbols_path, debugger_mode == DEBUGGER_DAP);
|
||||
#else
|
||||
sys_error("Debugging is not supported in this build.");
|
||||
#endif
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
# To use this script in MSYS2 shell, install mingw-w64-x86_64-nsis and
|
||||
# mingw-w64-x86_64-ntldd-git packages.
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo 'Usage: make-installer.sh <build-dir> <nsi>'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
builddir=$1
|
||||
nsi=$2
|
||||
|
||||
echo 'dlls.nsi:'
|
||||
ntldd -R $builddir/src/xsystem35.exe |perl -ne 'print "File \"$1\"\n" if /=> (.*) \(/' |grep mingw |tee $builddir/dlls.nsi
|
||||
echo
|
||||
|
||||
echo 'dlls-uninstall.nsi:'
|
||||
sed 's/^File ".*\\/Delete "$INSTDIR\\/' $builddir/dlls.nsi |tee $builddir/dlls-uninstall.nsi
|
||||
echo
|
||||
|
||||
makensis -INPUTCHARSET UTF8 -DBUILDDIR="$builddir" "$nsi"
|
||||
@@ -1,5 +0,0 @@
|
||||
Unicode true
|
||||
Name xsystem35
|
||||
OutFile xsystem35-32bit.exe
|
||||
InstallDir $PROGRAMFILES32\xsystem35
|
||||
!include xsystem35.nsi
|
||||
@@ -1,5 +0,0 @@
|
||||
Unicode true
|
||||
Name xsystem35
|
||||
OutFile xsystem35-64bit.exe
|
||||
InstallDir $PROGRAMFILES64\xsystem35
|
||||
!include xsystem35.nsi
|
||||
@@ -1,78 +0,0 @@
|
||||
ManifestDPIAware true
|
||||
SetCompressor /SOLID lzma
|
||||
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Japanese.nlf"
|
||||
|
||||
Page license
|
||||
Page directory
|
||||
Page components
|
||||
Page instfiles
|
||||
UninstPage uninstConfirm
|
||||
UninstPage instfiles
|
||||
|
||||
LicenseData ..\..\COPYING
|
||||
|
||||
!define SHCNE_ASSOCCHANGED 0x08000000
|
||||
!define SHCNF_IDLIST 0
|
||||
Function RefreshShellIcons
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v \
|
||||
(${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SetOutPath $INSTDIR
|
||||
FILE ${BUILDDIR}\src\xsystem35.exe
|
||||
!include ${BUILDDIR}\dlls.nsi
|
||||
SetOutPath $INSTDIR\fonts
|
||||
FILE /x CMakeLists.txt ..\..\fonts\*.*
|
||||
WriteUninstaller $INSTDIR\uninstall.exe
|
||||
|
||||
WriteRegStr HKLM "Software\Kichikuou\xsystem35" "InstallDir" "$INSTDIR"
|
||||
WriteRegStr HKLM "Software\Kichikuou\xsystem35\profile" "ttfont_gothic" "$INSTDIR\fonts\MTLc3m.ttf"
|
||||
WriteRegStr HKLM "Software\Kichikuou\xsystem35\profile" "ttfont_mincho" "$INSTDIR\fonts\mincho.otf"
|
||||
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xsystem35" "DisplayName" "xsystem35 (remove only)"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xsystem35" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
SectionEnd
|
||||
|
||||
LangString FileAssociation ${LANG_ENGLISH} "Associate with .ALD file type"
|
||||
LangString FileAssociation ${LANG_JAPANESE} ".ALD ファイルに関連付け"
|
||||
Section "$(FileAssociation)"
|
||||
WriteRegStr HKCR ".ald" "" "System35Archive"
|
||||
WriteRegStr HKCR "System35Archive" "" "AliceSoft System 3.x archive"
|
||||
WriteRegStr HKCR "System35Archive\DefaultIcon" "" "$INSTDIR\xsystem35.exe,0"
|
||||
WriteRegStr HKCR "System35Archive\shell\open\command" "" '"$INSTDIR\xsystem35.exe" "%1"'
|
||||
Call RefreshShellIcons
|
||||
SectionEnd
|
||||
|
||||
LangString DesktopIcon ${LANG_ENGLISH} "Create Desktop icon"
|
||||
LangString DesktopIcon ${LANG_JAPANESE} "デスクトップショートカットを作成"
|
||||
Section "$(DesktopIcon)"
|
||||
CreateShortcut $DESKTOP\xsystem35.lnk $INSTDIR\xsystem35.exe
|
||||
SectionEnd
|
||||
|
||||
LangString StartMenu ${LANG_ENGLISH} "Create Start menu entry"
|
||||
LangString StartMenu ${LANG_JAPANESE} "スタートメニューに登録"
|
||||
Section "$(StartMenu)"
|
||||
CreateDirectory $SMPROGRAMS\xsystem35
|
||||
CreateShortcut $SMPROGRAMS\xsystem35\xsystem35.lnk $INSTDIR\xsystem35.exe
|
||||
CreateShortcut $SMPROGRAMS\xsystem35\uninstall.lnk $INSTDIR\uninstall.exe
|
||||
SectionEnd
|
||||
|
||||
Section "Uninstall"
|
||||
Delete $DESKTOP\xsystem35.lnk
|
||||
RMDir /r $SMPROGRAMS\xsystem35
|
||||
|
||||
DeleteRegKey HKCR ".ald"
|
||||
DeleteRegKey HKCR "System35Archive"
|
||||
|
||||
DeleteRegKey HKLM "Software\Kichikuou\xsystem35"
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xsystem35"
|
||||
|
||||
RMDir /r $INSTDIR\fonts
|
||||
Delete $INSTDIR\uninstall.exe
|
||||
Delete $INSTDIR\xsystem35.exe
|
||||
!include ${BUILDDIR}\dlls-uninstall.nsi
|
||||
RMDir $INSTDIR
|
||||
SectionEnd
|
||||
+70
-65
@@ -1,36 +1,84 @@
|
||||
#----------------------------------------------------------
|
||||
# XSyetem35 設定ファイル
|
||||
# XSyetem35 Configuration File
|
||||
#
|
||||
# 行頭が '#' で始まる行はコメント行です
|
||||
# XSystem35 reads configuration from ~/.xsys35rc and .xsys35rc in the current
|
||||
# directory. The latter takes precedence over the former, so you should put
|
||||
# general settings in ~/.xsys35rc and game-specific settings in .xsys35rc
|
||||
# in the game directory.
|
||||
#
|
||||
# Lines starting with '#' are comments.
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# 使用するフォントの指定
|
||||
# Fonts
|
||||
#
|
||||
|
||||
# Gothic (sans-serif) and Mincho (serif) fonts. .ttf and .otf files are
|
||||
# supported.
|
||||
|
||||
#ttfont_gothic: /usr/local/share/xsystem35/fonts/MTLc3m.ttf
|
||||
#ttfont_mincho: /usr/local/share/xsystem35/fonts/mincho.otf
|
||||
#ttfont_gothic: /usr/local/share/xsystem35/fonts/MTLc3m.ttf
|
||||
|
||||
# Some fonts have multiple "faces" included. This specifies which face to use
|
||||
# from the font file.
|
||||
|
||||
# True Type フォントのフェイス指定
|
||||
#ttfont_mincho_face: 0
|
||||
#ttfont_gothic_face: 0
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# フォントのアンチエイリアスを無効にする
|
||||
# Disable font antialiasing.
|
||||
|
||||
#antialias: No
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Enables game-specific hacks. Usually auto-detected, but must be
|
||||
# specified for games with modified / translated titles.
|
||||
# Display
|
||||
#
|
||||
# Possible values are: toushin2, rance3_eng, rance4_eng, rance4_v2.
|
||||
|
||||
#game: rance4_v2
|
||||
# Enforce integer scaling.
|
||||
|
||||
#integerscale: Yes
|
||||
|
||||
# Disable custom mouse cursor defined in resource files.
|
||||
|
||||
#no_imagecursor: Yes
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Audio
|
||||
#
|
||||
|
||||
# CD-ROM device name.
|
||||
|
||||
#cdrom_device: /dev/cdrom
|
||||
|
||||
# device name of the raw midi device or sequencer device.
|
||||
|
||||
#midi_device: /dev/midi
|
||||
#midi_device: /dev/sequencer
|
||||
|
||||
# Audio buffer size in bytes.
|
||||
# Too small value causes sound glitches, too large value causes sound delay.
|
||||
|
||||
#audio_buffer_size: 2048
|
||||
|
||||
# MIDI Output method
|
||||
# 'e' : SDL_mixer (default)
|
||||
# 'pX' : via PortMidi (X is the device number, usually 0)
|
||||
# 'r' : raw midi device
|
||||
# 'sX' : sequencer device (X is the port number, usually 0)
|
||||
# '0' : disable MIDI
|
||||
|
||||
#midi_output_device: e
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Input
|
||||
#
|
||||
|
||||
# joystick device number (0-)
|
||||
|
||||
#joy_device: 0
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Miscellaneous
|
||||
#
|
||||
|
||||
# The format when writing save files.
|
||||
# xsystem35 : default
|
||||
# system36 : compatible with System3.5 v2 - System3.6
|
||||
@@ -38,59 +86,16 @@
|
||||
|
||||
#saveformat: xsystem35
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# CD-ROM のデバイス名
|
||||
# Enables game-specific hacks. Usually auto-detected, but must be
|
||||
# specified for games with modified / translated titles.
|
||||
#
|
||||
# Possible values are: toushin2, rance3_eng, rance4_eng, rance4_v2.
|
||||
|
||||
#cdrom_device: /dev/cdrom
|
||||
#game: rance4_v2
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Enables the ZB command (change the font weight). It is disabled by default
|
||||
# because it makes the text too bold with our default fonts.
|
||||
# This option is experimental and may be removed in the future. See
|
||||
# https://github.com/kichikuou/xsystem35-sdl2/issues/44 for details.
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# raw midi device または sequencer device のデバイス名
|
||||
#
|
||||
|
||||
#midi_device: /dev/midi
|
||||
##midi_device: /dev/sequencer
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# オーディオバッファのバイト数
|
||||
# 小さすぎると音が途切れ、大きくすると効果音が遅れるようになります。
|
||||
|
||||
#audio_buffer_size: 2048
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# MIDI Output method
|
||||
# 'e' : SDL_mixer (default)
|
||||
# 'pX' : via PortMidi (X is the device number, usually 0)
|
||||
# 'r' : raw midi device
|
||||
# 'sX' : sequencer device (X is the port number, usually 0)
|
||||
# '0' : disable MIDI
|
||||
#
|
||||
|
||||
#midi_output_device: e
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# joystick device のデバイス番号 (0-)
|
||||
#
|
||||
|
||||
#joy_device: 0
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# リソースファイルによるマウスカーソルの形状変更を無効にする
|
||||
# にする場合、以下を Yes にする (なにも指定しない場合は有効)
|
||||
#
|
||||
|
||||
#no_imagecursor: Yes
|
||||
|
||||
# -----------------------------------------------------------
|
||||
#enable_zb: Yes
|
||||
|
||||
Reference in New Issue
Block a user