Compare commits

...
117 Commits
Author SHA1 Message Date
kichikuou 3314f00bf8 Fix cdGetMaxTrack for download edition of Daiakuji
It should return the maximum index of the BGM archive.

Fixes #43.
2023-12-09 14:57:01 +09:00
kichikuou a2d79f045c Version 2.10.0 2023-12-09 13:08:30 +09:00
kichikuou f247495578 Breaking change: Fix ShArray.ChangeSecretArray
This breaks save file compatibility for Daiakuji and Kaeru nyo Kuni nyo
Alice.

Due to an incorrect encryption code in ShArray.ChangeSecretArray, save
files were not interoperable with system3.9. (Even worse, this bug did
not affect the checksum calculation and did not cause a "corrupt save
file" error when a file saved with system3.9 was loaded with xsystem35
or vice versa.)

Fixes #41.
2023-12-09 11:35:40 +09:00
kichikuou f6583330de debugger_dap: Fix a bug that seq of outgoing messages was not increasing 2023-12-08 08:57:56 +09:00
kichikuou 4b15f45897 debugger: Add custom DAP messages for communicating palette changes
This implements "xsystem35.palette" custom request and
"xsystem35.paletteChanged" custom event.

The "xsystem35.palette" request retrieves the color values of the AGS
palette.

  interface PaletteRequest extends Request {
    command: 'xsystem35.palette';
  }

  interface PaletteResponse extends Response {
    body: {
      /**
       * A number that increases each time the palette changes.
       */
      version: number;

      /**
       * 256 element array containing color values in 0xRRGGBB format.
       */
      palette: number[];
    };
  }

The "xsystem35.paletteChanged" event indicates that the AGS palette has
changed.

  interface PaletteChangedEvent extends Event {
    event: 'xsystem35.paletteChanged';

    body: {
      /**
       * A number that increases each time the palette changes.
       */
      version: number;
    };
  }

DAP clients can know if the received value is up to date by comparing
the `version` values of paletteChanged and PaletteResponse.
2023-12-08 08:35:45 +09:00
kichikuou 7bc433731f CI: Fix Android build
AGP 8.0 requires JDK 17.
2023-11-17 13:00:56 +09:00
kichikuou 4c21570eb1 Android: Upgrade SDL to 2.28.5 2023-11-17 12:15:17 +09:00
kichikuou a3e7feffc2 Switch Windows 64-bit build from mingw64 to ucrt64 2023-11-17 09:08:24 +09:00
kichikuou a4c1dd1acf Remove unused MOUSE_WARP_DIRECT mode 2023-09-04 17:14:17 +09:00
kichikuou 09086ccc85 IZ command: add delay even if mouse movement is disabled
Without it, it's hard to exit camp mode in TT2.
2023-09-04 17:03:06 +09:00
kichikuou 53e39b7c11 emscripten: Call xsystem35.shell.showMouseMoveEffect()
See kichikuou/web@07a6118 for details.
2023-09-04 13:32:04 +09:00
kichikuou f0ccfee40f Update internal mouse coordinates even if cursor movement is disabled
In TT2, keyboard/gamepad navigation is implemented by moving the mouse
cursor using IZ command. It did not work in browsers where mouse cursor
could not be moved or when mouse movement was disabled from the menu.

Now IZ command updates the internal mouse coordinates even when the
cursor cannot be moved.
2023-09-04 13:32:00 +09:00
kichikuou 10cdec98e6 emscripten: Improve gamepads support
In the W3C gamepad API, many gamepads are mapped to the "standard
layout", where D-pad keys are mapped to buttons 12-15.
2023-09-03 22:41:12 +09:00
kichikuou c61afb4308 Improve README.md
With the help of ChatGPT.
2023-08-29 12:09:30 +09:00
kichikuou f6cf881e61 Android: Sign apk only when keystore file exists 2023-08-28 11:01:33 +09:00
kichikuou a8277e71a7 Android: Update command line build instructions 2023-08-28 10:26:17 +09:00
kichikuou 3482fb6440 Android: Upgrade SDL to 2.28.2 2023-08-13 12:42:54 +09:00
kichikuou 3c81c8fec2 Improve error messages for when MIDI cannot be played
* Show warnings on failure of Mix_LoadMUS / Mix_PlayMusic
* Display "Cannot open playlist" warning only when the game does not
  have MIDI
2023-07-29 07:50:55 +09:00
fcolecumberri e090485b37 Update README.md
https://github.com/kichikuou/xsystem35-sdl2/issues/39
2023-07-28 21:42:59 +09:00
kichikuou d7deaec972 Version 2.9.1 2023-06-22 08:52:49 +09:00
kichikuou 30467371f4 debugger_dap: Handle SDL messages while paused in the debugger
So that you can move around the window while the game is paused.

Now DAP messages read from stdin are once posted to the SDL message
queue, and then inserted into the debugger command queue in the main
thread.
2023-06-20 11:07:28 +09:00
kichikuou e9a30f7493 Debugger: Fix crash when breakpoint condition was not met 2023-06-19 21:33:51 +09:00
kichikuou d9e42dd4bb Add a hack to fix Daiakuji's magenta battle background issue 2023-06-19 17:23:03 +09:00
kichikuou 0e06cc1e22 Simplify sdl_copyAreaSP16_shadow 2023-06-19 17:18:31 +09:00
kichikuou 89423c94f1 ShGraph: Use exact color match in PlayAnimeData and ChangeNotColor 2023-06-19 17:18:31 +09:00
kichikuou c694d2282c Fix CX (sprite copy) in 24-bit color games with 16-bit CGs
System3.x uses the following bit expansion when converting RGB565 to
RGB888:

  RRRRR GGGGGG BBBBB => RRRRRRRR GGGGGGGG BBBBBBBB
  12345 123456 12345    12345123 12345612 12345123

However, SDL's blit functions use a slightly different mapping, so
sometimes expanded color did not match the color key specified in the CX
command.

To avoid this, convert to RGB888 by ourselves when drawing 16-bit CGs.
2023-06-19 17:18:17 +09:00
kichikuou 39e94afc44 Specify pixel format explicitly when creating SDL surfaces 2023-06-18 14:47:50 +09:00
kichikuou e37a491908 Refactor keycode definitions 2023-05-21 10:46:22 +09:00
kichikuou 43dff9a9e4 Version 2.9.0 2023-05-04 14:19:52 +09:00
kichikuou e6b3d6094d Use System3.9 compatible save format by default, except emscripten 2023-05-04 13:40:35 +09:00
kichikuou 61ad4282e6 Refactor agsevent_t struct 2023-05-04 11:51:21 +09:00
kichikuou e4628d8bbb emscripten: Add simulate_right_button() 2023-05-04 11:27:45 +09:00
kichikuou 21bd4279a1 Send AGS mouse events on touch events
This fixes a bug where SACT games were not responding to touch.
2023-05-04 09:01:16 +09:00
kichikuou b6c33fd761 Update emscripten to 3.1.34 2023-05-03 17:43:35 +09:00
kichikuou 1b9d8c48f1 Android: Use Kotlin coroutine for background installation 2023-04-15 15:59:54 +09:00
kichikuou 55ef307e07 Android: Stop using deprecated ProgressDialog 2023-04-15 11:43:41 +09:00
kichikuou 894cd51e01 Improve ZZ0,1 behavior
- Check nact->is_quit
- Avoid busy loop in emscripten
2023-03-28 22:03:12 +09:00
kichikuou 880244020e Android: Use SDL_mixer for CD audio 2023-03-18 11:21:06 +09:00
kichikuou 9c2f423399 Fix use-of-uninitialized-value in save_savePartial 2023-03-18 10:41:12 +09:00
kichikuou 654a489f49 Fix memory leaks in debugger_dap.c 2023-03-18 10:32:49 +09:00
kichikuou 912af592ae Clean up savedata.c 2023-03-18 09:51:57 +09:00
kichikuou 6d70439dff Change how save file names are determined when no .gr file is specified
If `?sleep.asd` already exist, use them. Otherwise use `*s?.asd` as in
System3x.exe.
2023-03-18 09:51:51 +09:00
kichikuou aec06f775a Support the save format of original System3.x (except System3.5 v1)
Now xsystem35 can load ASD files created by System3.5 (v2+) - System3.9.
The format for saving can be configured with the -saveformat option.
2023-02-23 19:03:23 +09:00
kichikuou 446ffe9466 UG command: Fix order of popping variables 2023-02-22 17:35:45 +09:00
kichikuou 02cad74568 Allow resizing system page by DC command 2023-02-20 17:39:21 +09:00
kichikuou 33e1ff3b4a Increase system variable page size to 65537
To match System3.x.
2023-02-20 17:05:54 +09:00
kichikuou 11f8f00072 Match default message/selection window locations to System3.x 2023-02-20 16:32:32 +09:00
kichikuou b59d683fef Change the stack layout
Now we use the same stack structure as System3.9. In order to maintain
the compatibility of save files, it is converted to/from the old layout
when saving/loading.
2023-02-20 14:24:37 +09:00
kichikuou b9f4c7c03a Compatibility fix for Bx commands
These commands accept 0-127 as valid window numbers, which were 1-128
before this change.

To maintain savedata compatibility, window positions are saved in the
order 1,...,127,0.
2023-02-18 21:45:39 +09:00
kichikuou 2d2c6aa373 Remove strvar_len
The length limit of string variables was removed a long time ago, but it
was recorded in save files.

Now the first argument of MZ0 is completely ignored (as in System3.9).
The maxlen field in the save file is set to a constant so that older
versions of xsystem35 can load it.
2023-02-18 14:55:02 +09:00
kichikuou 850af6d140 Refactor implementation of LE and QE commands 2023-02-18 14:47:28 +09:00
kichikuou da4cf017bf Clean up savedata.h 2023-02-18 14:47:25 +09:00
kichikuou e88dfcdaa1 Move load_cg_with_file to cg.c 2023-02-18 09:27:21 +09:00
kichikuou 70a940b216 Version 2.8.0 2023-02-12 09:33:29 +09:00
kichikuou db2bb03fdd Add -help description for -game option 2023-02-12 09:12:09 +09:00
kichikuou 5ef949ae14 Refactor ags_setWindowTitle() 2023-02-11 21:40:14 +09:00
kichikuou 043028cf7d Update game_compatibility.md 2023-02-11 16:18:09 +09:00
kichikuou eace5d1dbd Refactor game-specific hacks, add -game option
It's now possible to enable certain game-specific hacks by using the
`-game` command line option or the `game` property in the .xsys35rc
file.
2023-02-11 15:27:38 +09:00
kichikuou 878bea69d6 Add a test for stack commands 2023-02-10 21:30:02 +09:00
kichikuou ae8becc4a3 Fix menuReturnGoto when stack top is not a return address 2023-02-10 21:24:13 +09:00
kichikuou 1d863cfb2e Implement UR command 2023-02-10 20:56:53 +09:00
kichikuou 7bb2bee693 Label return should pop TPx 2023-02-10 20:56:53 +09:00
kichikuou 47e7f5542e Remove sl_retFar2
In System39.exe `%0` drops stack frames for label calls (Rance4 v2
relies on this behavior), so it's the same as `UD 1`.
2023-02-10 20:56:53 +09:00
kichikuou 8087d11b2b Fix UC command
* UC0 should restore values pushed by US/TPx
* UC1 should stop when the stack top is a page call
* UC1/2 should restore status pushes by TPx
* UC1/2 should not consume the count for non-call stack frames
* Add support for UC3 command
2023-02-10 20:56:53 +09:00
kichikuou 4f1521ac90 TOx commands are no-op if the stack top is of an unexpected type 2023-02-10 20:56:53 +09:00
kichikuou 99632397da Enable the hack in Rance4v2 recompiled with System3.9
The System3.9 compiler compiles `MT` command to `0x2F28`, so the hack
must be enabled in commands2F28().

Fixes https://github.com/kichikuou/xsystem35-sdl2/issues/36.
2023-02-10 20:50:12 +09:00
kichikuou 59283815d8 Properly implement Y 1900 command
It is the same as patchEC, but can be used in SCO files less than
version 390.
2023-02-08 10:43:06 +09:00
kichikuou a32c901eb8 Tweak the Rance4v2 hack
This fixes https://github.com/kichikuou/xsystem35-sdl2/issues/35.
2023-02-08 10:15:06 +09:00
kichikuou 03b84b8ba7 Make UR command safer
It's still unimplemented, but clears the output variables for safety.
2023-02-07 22:12:35 +09:00
kichikuou 720da4e42c Fix UC1 command 2023-02-07 22:05:00 +09:00
kichikuou c4dc799c94 Change the condition for applying Rance4v2 hack
Now it's determined by the MT command argument.
2023-02-07 21:31:03 +09:00
kichikuou ce271ae5eb Fix CG positioning issue in Rance 4.x (TOTO port)
G command should reset the effect of J0/J1, even if pixel extraction is
disabled by PC command.
2023-02-05 18:37:50 +09:00
kichikuou 526e5f8709 Fix VSP palette issue
This fixes a palette problem when drawing a VSP image on a non-8-bit
surface after executing `ZC 0` command.

cg->vsp_bank can be overridden by the `ZC 0` command.
2023-02-05 18:08:41 +09:00
kichikuou c967e63be9 Version 2.7.0 2023-01-28 16:22:24 +09:00
kichikuou d4a32aee17 Update game_compatibility.md 2023-01-28 16:13:25 +09:00
kichikuou 1191723612 Update emscripten to 3.1.27 2023-01-28 14:30:45 +09:00
kichikuou addf2e3728 Add BGM support for Rance4 v2
In Rance4 v2, `SS n` command plays the audio file n+999 stored in
WB.ald. Support this by reusing the CD->BGM bridge.
2023-01-28 14:24:26 +09:00
kichikuou 4785c8c77c Add cdrom.bgm.c and use it when DRIFILE_BGM exists
This enables BGM playback in the download edition of Daiakuji, where S*
commands are plumbed to the music system (*BA.ald).
2023-01-28 13:06:38 +09:00
kichikuou b1ac106057 Refactor bgm abstructions 2023-01-28 12:51:38 +09:00
kichikuou acdc40ec60 Refactor cdrom abstructions 2023-01-28 12:51:34 +09:00
kichikuou d9f635a6d0 Implement SV command 2023-01-28 09:53:44 +09:00
kichikuou e8357c4e6f Add a hack to improve map navigation of Rance4 v2 2023-01-28 09:53:41 +09:00
kichikuou 8e44a87069 Support Y1003 command
Used in Rance4 ver2.05. Similar to Y3, but waits for key release.
2023-01-26 21:44:29 +09:00
kichikuou d1befbd355 Add stub for SV command
Used in Rance4 ver2.05.
2023-01-26 18:35:55 +09:00
kichikuou ec0bae5490 Inline LittleEndian functions
Using memcpy(). Compilers are smart enough to eliminate memcpy()
completely.
2023-01-21 17:22:24 +09:00
kichikuou f5b3b1a936 Support ShSound module on WASM 2023-01-21 16:40:26 +09:00
kichikuou 1b546e3bab Update README.md 2023-01-15 13:52:00 +09:00
kichikuou d454899048 Add game compatibility table 2023-01-15 13:39:07 +09:00
kichikuou 7aa704b3f4 midi_sdlmixer: Check playing status in midi_get_playing_info()
This fixes an infinite loop in Buroburo waiting for MIDI playback to
finish.
2023-01-15 13:07:51 +09:00
kichikuou 50d7d7ee33 Fix handling of multi-volume ALD with inconsistent indexes
When contents of the index table differ between ALD files, System3.x
uses information from the file containing the entry.

For example, if link_table[k] in SA.ALD is { file_nr = 2, ptr_no = 10 }
and link_table[k] in SB.ALD is { file_nr = 2, ptr_no = 11 }, the entry
body is in SB.ALD, so ptr_no = 11 should be used.

CA_G*.ALD of Child Assassin has this issue.
2023-01-15 12:42:38 +09:00
kichikuou 586a9c855e Implement LXX 5 command
Used in Child Assassin.
2023-01-14 16:13:57 +09:00
kichikuou 9600e34229 Android: Upgrade AGP to 7.3.1 2023-01-08 13:35:51 +09:00
kichikuou 001c97ea00 Android: Include git revision in version string 2023-01-08 13:20:23 +09:00
kichikuou b100dbe26c Android CI: Generate signed apk 2023-01-08 13:19:01 +09:00
kichikuou 55e38f9db2 Android: Add activities to display open source notices 2023-01-06 14:21:32 +09:00
kichikuou ddf6fba393 Version 2.6.0 2023-01-01 15:23:29 +09:00
kichikuou 83fa5db82c Windows: Add a menu command to control automatic mouse movement 2022-12-29 21:57:53 +09:00
kichikuou 1807cf0c26 Android: Update SDL2 and companion libraries
- SDL 2.26.1
- SDL_ttf 2.20.1
- SDL_mixer 2.6.2
2022-12-29 14:24:20 +09:00
kichikuou 5906079d3f Windows CI: Use latest msys2 packages 2022-12-29 14:24:09 +09:00
kichikuou 7fba19fe18 New way to simulate right-clicks on touch devices
As with xsystem4-android, now touches outside the game's viewport are
treated as right-clicks,

The old method (two-finger touch) still works.
2022-12-29 14:23:43 +09:00
kichikuou 8de86e276d CI: Update GH actions 2022-11-26 16:47:29 +09:00
kichikuou 64a5f47258 Android: Use SDK-bundled CMake 3.22.1 2022-10-29 11:05:37 +09:00
kichikuou 29a139c8a1 Use the standard integer types
This replaces BYTE, WORD and DWORD types with uint8_t, uint16_t and
uint32_t respectively.
2022-10-29 09:34:21 +09:00
kichikuou b53c82e072 Replace debug printf() calls with WARNING() 2022-09-08 21:19:19 +09:00
kichikuou 307bb2623b Remove SDL_LockSurface() calls
It shouldn't be needed.
2022-09-04 22:26:58 +09:00
kichikuou d1712ab7b4 Remove newline character from debug print macro calls
Now "\n" is appended by the macros.
2022-09-02 20:37:26 +09:00
kichikuou 7c24ba276d Emscripten: Add nact_current_page() and nact_current_addr() 2022-08-28 09:25:03 +09:00
kichikuou c8f9880efb Fix buffer overrun in LE/QE command 2022-08-28 08:43:18 +09:00
kichikuou d508676c70 Refactoring: Introduce getCaliArray()
This replaces global preVar{No,Page,Index} variables.
2022-08-27 16:11:36 +09:00
kichikuou 92506d6a94 Refactor variable page management code
Now system variables can be accessed via varPage[0].
2022-08-27 13:22:27 +09:00
kichikuou 0a37920c95 Version 2.5.1 2022-07-31 16:07:25 +09:00
kichikuou fa44889047 Fix a bug in sdl_setPalette()
It called SDL_SetPaletteColors() with wrong arguments when `first` was
not zero. PP command was affected by this.
2022-07-31 13:53:37 +09:00
kichikuou cee18a572e Implement palette shift effect (CD 1001)
Used in Toushin Toshi 2.
2022-07-31 12:44:30 +09:00
kichikuou 652d284628 Debugger: Check out-of-bounds array access
This prevents the debugger from SEGVing when trying to access a
variable.
2022-07-30 18:14:35 +09:00
kichikuou d2661e97f1 sdl_effect: Implement EFFECT_CIRCLE_WIPE_{IN,OUT} 2022-07-23 10:57:59 +09:00
kichikuou 0e9afe7c0a Implement grDrawFillCircle 2022-07-23 09:18:58 +09:00
kichikuou fbe8af5f7b Fix command line option name in README.md 2022-07-17 22:22:36 +09:00
260 changed files with 6755 additions and 6269 deletions
+10 -5
View File
@@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Deps
run: sudo apt install ninja-build
@@ -14,10 +14,15 @@ jobs:
- name: Build
run: |
cd android
ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle ./gradlew assembleRelease
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > keystore.jks
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 }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
- name: Upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: xsystem35-release-unsigned-apk
path: android/app/build/outputs/apk/release/app-release-unsigned.apk
name: xsystem35-apk
path: android/app/build/outputs/apk/release/app-release.apk
+5 -5
View File
@@ -2,7 +2,7 @@ name: Emscripten Build
on: [push, pull_request]
env:
EM_VERSION: 3.1.15
EM_VERSION: 3.1.34
EM_CACHE_FOLDER: 'emsdk-cache'
jobs:
@@ -10,17 +10,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup cache
id: cache-system-libraries
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{ runner.os }}
- name: Setup Emscripten toolchain
uses: mymindstorm/setup-emsdk@v10
uses: mymindstorm/setup-emsdk@v12
with:
version: ${{ env.EM_VERSION }}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
@@ -35,7 +35,7 @@ jobs:
mv src/xsystem35.* xsystem35/
- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: xsystem35-wasm
path: out/wasm/xsystem35
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
name: Linux ${{ matrix.build-type }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Deps
run: |
+4 -4
View File
@@ -8,7 +8,7 @@ jobs:
matrix:
include:
- { sys: MINGW32, installer: "xsystem35-32bit" }
- { sys: MINGW64, installer: "xsystem35-64bit" }
- { sys: UCRT64, installer: "xsystem35-64bit" }
defaults:
run:
shell: msys2 {0}
@@ -29,10 +29,10 @@ jobs:
libwebp:p
cjson:p
nsis:p
ntldd-git:p
ntldd:p
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Build
run: |
@@ -50,7 +50,7 @@ jobs:
run: ./make-installer.sh ../../out/release ${{ matrix.installer }}.nsi
- name: Upload
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.installer }}
path: tools/installer/${{ matrix.installer }}.exe
+2
View File
@@ -2,7 +2,9 @@ out
android/.gradle
android/app/.externalNativeBuild
android/app/build
android/app/src/main/assets
android/build
android/keystore.jks
.ccls-cache
.dir-locals.el
compile_commands.json
+2 -5
View File
@@ -110,6 +110,7 @@ endif()
# CDROM
list(APPEND SRC_CDROM cdrom.bgm.c)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND SRC_CDROM cdrom.Linux.c)
list(APPEND SUMMARY_CDROM "Linux ioctl")
@@ -122,14 +123,10 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
list(APPEND SRC_CDROM cdrom.emscripten.c)
list(APPEND SUMMARY_CDROM "Emscripten")
set(ENABLE_CDROM_EMSCRIPTEN 1)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Android")
list(APPEND SRC_CDROM cdrom.android.c)
list(APPEND SUMMARY_CDROM "Android")
set(ENABLE_CDROM_ANDROID 1)
else()
list(APPEND SRC_CDROM cdrom.empty.c)
endif()
if (SDL2MIXER_FOUND AND NOT ANDROID)
if (SDL2MIXER_FOUND)
list(APPEND SRC_CDROM cdrom.mp3.c)
list(APPEND SUMMARY_CDROM "SDL_mixer (wav|mp3|ogg...)")
set(ENABLE_CDROM_MP3 1)
+74 -49
View File
@@ -3,17 +3,22 @@
This is a multi-platform port of `xsystem35`, a free implementation of
AliceSoft's System 3.x game engine.
## Compatibility
See the [game compatibility table](game_compatibility.md) for a list of games
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
@@ -22,89 +27,109 @@ 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 `-debugger` 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).
Execute `xsystem35`, and a dialog will appear for you to select a folder.
Choose the game folder (where the ALD files are located).
### 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.
+35 -23
View File
@@ -1,61 +1,73 @@
# 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:
- CMake >=3.20
- Android SDK >=28
- Android NDK >=r15c
### 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
sudo apt install -t bullseye-backports cmake
# 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-7583922_latest.zip
unzip commandlinetools-linux-7583922_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
$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager ndk-bundle
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. Two-finger touch is treated as a right click.
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.
+29 -16
View File
@@ -9,33 +9,47 @@ 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 9
versionName "2.5.0"
targetSdkVersion 34
versionCode 16
versionName "2.10.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'
}
}
}
signingConfigs {
release {
storeFile rootProject.file('keystore.jks')
storePassword System.getenv('KEYSTORE_PASSWORD')
keyAlias System.getenv('KEY_ALIAS')
keyPassword System.getenv('KEY_PASSWORD')
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if (rootProject.file('keystore.jks').exists()) {
signingConfig signingConfigs.release
}
}
}
applicationVariants.all { variant ->
tasks["merge${variant.name.capitalize()}Assets"]
.dependsOn("externalNativeBuild${variant.name.capitalize()}")
}
if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
sourceSets.main {
jniLibs.srcDir 'libs'
assets.srcDir '../../fonts'
}
aaptOptions {
// Disable asset compression for fonts.
@@ -44,18 +58,16 @@ android {
}
externalNativeBuild {
cmake {
// xsystem35 requires CMake >=3.13, so SDK-bundled CMake
// (3.6 or 3.10.2) cannot be used.
version getInstalledCmakeVersion()
version '3.22.1'
path 'jni/CMakeLists.txt'
}
}
}
lintOptions {
lint {
abortOnError false
}
if (buildAsLibrary) {
libraryVariants.all { variant ->
variant.outputs.each { output ->
@@ -72,8 +84,9 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
}
static String getInstalledCmakeVersion() {
('cmake --version'.execute().text =~ /cmake version ([0-9.]+)/)[0][1]
static String gitRevision() {
' (git ' + "git rev-parse --short HEAD".execute().text.trim() + ')'
}
+31 -12
View File
@@ -1,22 +1,23 @@
cmake_minimum_required(VERSION 3.13)
project(GAME)
set(PROJECT_ROOT_DIR ../../..)
include(FetchContent)
FetchContent_Declare(
SDL
URL https://libsdl.org/release/SDL2-2.0.20.tar.gz
URL_HASH SHA1=18ce006cbf07502f48abfedc088c14404091f3d3
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
URL https://github.com/libsdl-org/SDL_ttf/archive/refs/tags/release-2.0.18.tar.gz
URL_HASH SHA1=6fc5130757b447d46c3da6abd58687e8576de8b8
URL https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.20.1/SDL2_ttf-2.20.1.tar.gz
URL_HASH SHA1=f774ff407915ae4afa3d03e5a9395283d9090f28
)
FetchContent_Declare(
SDL_mixer
URL https://github.com/libsdl-org/SDL_mixer/archive/refs/tags/release-2.6.0.tar.gz
URL_HASH SHA1=a2aef03d74ac3dd9cd0004cff1834602a5dafa66
URL https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.6.2/SDL2_mixer-2.6.2.tar.gz
URL_HASH SHA1=036fc7839a6b8dc1af3dbfed4e2531224bbacdd7
)
# Compilation of SDL and companion libraries
@@ -28,18 +29,36 @@ 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_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()
# The main CMakeLists.txt of xsystem35
add_subdirectory(../../.. xsystem35)
add_subdirectory(${PROJECT_ROOT_DIR} xsystem35)
# Copy asset files
set(ASSETS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../src/main/assets)
file(MAKE_DIRECTORY ${ASSETS_DIR}/licenses)
file(COPY_FILE ${PROJECT_ROOT_DIR}/fonts/MTLc3m.ttf ${ASSETS_DIR}/MTLc3m.ttf)
file(COPY_FILE ${PROJECT_ROOT_DIR}/fonts/mincho.otf ${ASSETS_DIR}/mincho.otf)
file(COPY_FILE ${PROJECT_ROOT_DIR}/COPYING ${ASSETS_DIR}/licenses/xsystem35)
file(COPY_FILE ${PROJECT_ROOT_DIR}/fonts/MTLc3m.ttf.license ${ASSETS_DIR}/licenses/MTLc3m)
file(COPY_FILE ${PROJECT_ROOT_DIR}/fonts/mincho.otf.license ${ASSETS_DIR}/licenses/mincho)
file(COPY_FILE ${sdl_SOURCE_DIR}/LICENSE.txt ${ASSETS_DIR}/licenses/SDL)
file(COPY_FILE ${sdl_ttf_SOURCE_DIR}/LICENSE.txt ${ASSETS_DIR}/licenses/SDL_ttf)
file(COPY_FILE ${sdl_ttf_SOURCE_DIR}/external/freetype/docs/GPLv2.TXT ${ASSETS_DIR}/licenses/freetype)
file(COPY_FILE ${sdl_ttf_SOURCE_DIR}/external/harfbuzz/COPYING ${ASSETS_DIR}/licenses/harfbuzz)
file(COPY_FILE ${sdl_mixer_SOURCE_DIR}/LICENSE.txt ${ASSETS_DIR}/licenses/SDL_mixer)
+1 -1
View File
@@ -13,6 +13,6 @@ LOCAL_SRC_FILES := YourSourceHere.c
LOCAL_SHARED_LIBRARIES := SDL2
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid
include $(BUILD_SHARED_LIBRARY)
+11 -1
View File
@@ -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 -->
@@ -94,6 +93,17 @@
</intent-filter>
-->
</activity>
<activity android:name=".LicensesMenuActivity"
android:label="@string/action_licenses"
android:parentActivityName=".LauncherActivity"
android:exported="false">
</activity>
<activity android:name=".LicensesActivity"
android:parentActivityName=".LicensesMenuActivity"
android:exported="false">
</activity>
</application>
</manifest>
@@ -37,24 +37,20 @@ class GameActivity : SDLActivity() {
}
private lateinit var gameRoot: File
private lateinit var cdda: CddaPlayer
private val midi = MidiPlayer()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
gameRoot = File(intent.getStringExtra(EXTRA_GAME_ROOT)!!)
cdda = CddaPlayer(File(gameRoot, Launcher.PLAYLIST_FILE))
}
override fun onStop() {
super.onStop()
cdda.onActivityStop()
midi.onActivityStop()
}
override fun onResume() {
super.onResume()
cdda.onActivityResume()
midi.onActivityResume()
}
@@ -63,7 +59,9 @@ class GameActivity : SDLActivity() {
}
override fun getArguments(): Array<String> {
return arrayOf("-gamedir", intent.getStringExtra(EXTRA_GAME_ROOT)!!)
return arrayOf(
"-gamedir", intent.getStringExtra(EXTRA_GAME_ROOT)!!,
"-devcd", Launcher.PLAYLIST_FILE)
}
override fun setTitle(title: CharSequence?) {
@@ -120,9 +118,6 @@ class GameActivity : SDLActivity() {
}
// The functions below are called in the SDL thread by JNI.
@Suppress("unused") fun cddaStart(track: Int, loop: Boolean) = cdda.start(track, loop)
@Suppress("unused") fun cddaStop() = cdda.stop()
@Suppress("unused") fun cddaCurrentPosition() = cdda.currentPosition()
@Suppress("unused") fun midiStart(path: String, loop: Boolean) = midi.start(path, loop)
@Suppress("unused") fun midiStop() = midi.stop()
@Suppress("unused") fun midiCurrentPosition() = midi.currentPosition()
@@ -156,69 +151,6 @@ class GameActivity : SDLActivity() {
}
}
private class CddaPlayer(private val playlistPath: File) {
private val playlist =
try {
playlistPath.readLines()
} catch (e: IOException) {
Log.e("loadPlaylist", "Cannot load $playlistPath", e)
emptyList()
}
private var currentTrack = 0
private val player = MediaPlayer()
private var playerPaused = false
fun start(track: Int, loop: Boolean) {
val f = playlist.elementAtOrNull(track - 1)
if (f.isNullOrEmpty()) {
Log.w("cddaStart", "No playlist entry for track $track")
return
}
Log.v("cddaStart", "$f Loop:$loop")
try {
player.apply {
reset()
setDataSource(File(playlistPath.parent, f).path)
isLooping = loop
prepare()
start()
}
currentTrack = track
} catch (e: IOException) {
Log.e("cddaStart", "Cannot play $f", e)
player.reset()
}
}
fun stop() {
if (currentTrack > 0 && player.isPlaying) {
player.stop()
currentTrack = 0
}
}
fun currentPosition(): Int {
if (currentTrack == 0)
return 0
val frames = player.currentPosition * 75 / 1000
return currentTrack or (frames shl 8)
}
fun onActivityStop() {
if (currentTrack > 0 && player.isPlaying) {
player.pause()
playerPaused = true
}
}
fun onActivityResume() {
if (playerPaused) {
player.start()
playerPaused = false
}
}
}
private class MidiPlayer {
private val player = MediaPlayer()
private var playing = false
@@ -17,11 +17,13 @@
*/
package io.github.kichikuou.xsystem35
import android.annotation.SuppressLint
import android.os.Build
import android.os.Handler
import android.os.Message
import android.util.Log
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.*
import java.lang.StringBuilder
import java.nio.charset.Charset
@@ -40,9 +42,6 @@ interface LauncherObserver {
}
private const val SAVE_DIR = "save"
private const val PROGRESS = 0
private const val SUCCESS = 1
private const val FAILURE = 2
class Launcher private constructor(private val rootDir: File) {
companion object {
@@ -74,31 +73,28 @@ class Launcher private constructor(private val rootDir: File) {
updateGameList()
}
@OptIn(DelicateCoroutinesApi::class)
fun install(input: InputStream, archiveName: String?) {
val dir = createDirForGame()
@SuppressLint("HandlerLeak")
val handler = object : Handler() {
override fun handleMessage(msg: Message) {
when (msg.what) {
PROGRESS -> {
observer?.onInstallProgress(msg.obj as String)
}
SUCCESS -> {
isInstalling = false
observer?.onInstallSuccess(msg.obj as File, archiveName)
}
FAILURE -> {
isInstalling = false
observer?.onInstallFailure(msg.obj as Int)
isInstalling = true
GlobalScope.launch(Dispatchers.Main) {
try {
withContext(Dispatchers.IO) {
extractFiles(input, dir) { msg ->
GlobalScope.launch(Dispatchers.Main) {
observer?.onInstallProgress(msg)
}
}
}
observer?.onInstallSuccess(dir, archiveName)
} catch (e: InstallFailureException) {
observer?.onInstallFailure(e.msgId)
} catch (e: Exception) {
Log.e("launcher", "Failed to extract ZIP", e)
observer?.onInstallFailure(R.string.zip_extraction_error)
}
isInstalling = false
}
val t = Thread {
extractFiles(input, dir, handler)
}
t.start()
isInstalling = true
}
fun uninstall(id: Int) {
@@ -183,32 +179,26 @@ class Launcher private constructor(private val rootDir: File) {
}
}
private fun extractFiles(input: InputStream, outDir: File, handler: Handler) {
try {
val configWriter = GameConfigWriter()
val hadDecodeError = forEachZipEntry(input) { zipEntry, zip ->
Log.i("extractFiles", zipEntry.name)
val path = File(outDir, zipEntry.name)
if (zipEntry.isDirectory)
return@forEachZipEntry
path.parentFile?.mkdirs()
handler.sendMessage(handler.obtainMessage(PROGRESS, zipEntry.name))
FileOutputStream(path).buffered().use {
zip.copyTo(it)
}
configWriter.maybeAdd(zipEntry.name)
private fun extractFiles(input: InputStream, outDir: File, progressCallback: (String) -> Unit) {
val configWriter = GameConfigWriter()
val hadDecodeError = forEachZipEntry(input) { zipEntry, zip ->
Log.i("extractFiles", zipEntry.name)
val path = File(outDir, zipEntry.name)
if (zipEntry.isDirectory)
return@forEachZipEntry
path.parentFile?.mkdirs()
progressCallback(zipEntry.name)
FileOutputStream(path).buffered().use {
zip.copyTo(it)
}
if (!configWriter.readyToWrite()) {
val msgId = if (hadDecodeError) R.string.unsupported_zip else R.string.cannot_find_ald
handler.sendMessage(handler.obtainMessage(FAILURE, msgId))
return
}
configWriter.write(outDir)
handler.sendMessage(handler.obtainMessage(SUCCESS, outDir))
} catch (e: IOException) {
Log.e("launcher", "Failed to extract ZIP", e)
handler.sendMessage(handler.obtainMessage(FAILURE, R.string.zip_extraction_error))
configWriter.maybeAdd(zipEntry.name)
}
if (!configWriter.readyToWrite()) {
if (hadDecodeError)
throw InstallFailureException(R.string.unsupported_zip)
throw InstallFailureException(R.string.cannot_find_ald)
}
configWriter.write(outDir)
}
// Xsystem35-sdl2 <=2.2.0 had a bug where playlist had an extra empty line at
@@ -219,12 +209,14 @@ class Launcher private constructor(private val rootDir: File) {
if (!oldPlaylist.exists())
return
var tracks = oldPlaylist.readLines()
if (!tracks.isEmpty())
if (tracks.isNotEmpty())
tracks = tracks.subList(1, tracks.size)
File(dir, PLAYLIST_FILE).writeText(tracks.joinToString("\n"))
oldPlaylist.delete()
}
class InstallFailureException(val msgId: Int) : Exception()
// A helper class which generates xsystem35.gr and playlist.txt in the game root directory.
private class GameConfigWriter {
private val grb = StringBuilder()
@@ -27,6 +27,7 @@ import android.view.Menu
import android.view.MenuItem
import android.widget.ArrayAdapter
import android.widget.ListView
import android.widget.TextView
import android.widget.Toast
import java.io.*
@@ -34,10 +35,11 @@ private const val CONTENT_TYPE_ZIP = "application/zip"
private const val INSTALL_REQUEST = 1
private const val SAVEDATA_EXPORT_REQUEST = 2
private const val SAVEDATA_IMPORT_REQUEST = 3
private const val STATE_PROGRESS_TEXT = "progressText"
class LauncherActivity : Activity(), LauncherObserver {
private lateinit var launcher: Launcher
private var progressDialog: ProgressDialogFragment? = null
private var progressDialog: Dialog? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -46,7 +48,7 @@ class LauncherActivity : Activity(), LauncherObserver {
launcher = Launcher.getInstance(filesDir)
launcher.observer = this
if (launcher.isInstalling) {
showProgressDialog()
showProgressDialog(savedInstanceState)
}
onGameListChange()
@@ -61,9 +63,17 @@ class LauncherActivity : Activity(), LauncherObserver {
override fun onDestroy() {
launcher.observer = null
dismissProgressDialog()
super.onDestroy()
}
override fun onSaveInstanceState(outState: Bundle) {
progressDialog?.let {
outState.putCharSequence(STATE_PROGRESS_TEXT, it.findViewById<TextView>(R.id.text).text)
}
super.onSaveInstanceState(outState)
}
private fun onListItemClick(position: Int) {
if (position < launcher.games.size) {
startGame(launcher.games[position].path, null)
@@ -106,6 +116,11 @@ class LauncherActivity : Activity(), LauncherObserver {
SAVEDATA_IMPORT_REQUEST)
true
}
R.id.licenses -> {
val intent = Intent(this, LicensesMenuActivity::class.java)
startActivity(intent)
true
}
else -> super.onOptionsItemSelected(item)
}
}
@@ -148,7 +163,7 @@ class LauncherActivity : Activity(), LauncherObserver {
}
override fun onInstallProgress(path: String) {
progressDialog?.setProgress(getString(R.string.install_progress, path))
progressDialog?.findViewById<TextView>(R.id.text)?.text = getString(R.string.install_progress, path)
}
override fun onInstallSuccess(path: File, archiveName: String?) {
@@ -173,9 +188,17 @@ class LauncherActivity : Activity(), LauncherObserver {
launcher.uninstall(id)
}
private fun showProgressDialog() {
progressDialog = ProgressDialogFragment()
progressDialog!!.show(fragmentManager, "progress_dialog")
private fun showProgressDialog(savedInstanceState: Bundle? = null) {
progressDialog = Dialog(this)
progressDialog!!.apply {
setTitle(R.string.install_dialog_title)
setCancelable(false)
setContentView(R.layout.progress_dialog)
savedInstanceState?.let {
findViewById<TextView>(R.id.text)?.text = it.getCharSequence(STATE_PROGRESS_TEXT)
}
show()
}
}
private fun dismissProgressDialog() {
@@ -204,18 +227,3 @@ class LauncherActivity : Activity(), LauncherObserver {
return null
}
}
@Suppress("DEPRECATION") // for ProgressDialog
class ProgressDialogFragment : DialogFragment() {
private lateinit var dialog: ProgressDialog
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
dialog = ProgressDialog(activity)
return dialog.apply {
setTitle(R.string.install_dialog_title)
setCancelable(true)
}
}
fun setProgress(msg: String) {
dialog.setMessage(msg)
}
}
@@ -0,0 +1,23 @@
package io.github.kichikuou.xsystem35
import android.app.Activity
import android.os.Bundle
import android.widget.TextView
import java.io.BufferedReader
class LicensesActivity : Activity() {
companion object {
const val EXTRA_DISPLAY_NAME = "DISPLAY_NAME"
const val EXTRA_FILE_NAME = "FILE_NAME"
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_licenses)
actionBar?.title = intent.getStringExtra(EXTRA_DISPLAY_NAME)
val path = "licenses/" + intent.getStringExtra(EXTRA_FILE_NAME)
val text = assets.open(path).bufferedReader().use(BufferedReader::readText)
findViewById<TextView>(R.id.license_text).text = text
}
}
@@ -0,0 +1,38 @@
package io.github.kichikuou.xsystem35
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.widget.ListView
import android.widget.SimpleAdapter
class LicensesMenuActivity : Activity() {
class Entry(val displayName: String, val fileName: String, val url: String)
private val entries: ArrayList<Entry> = arrayListOf(
Entry("xsystem35-sdl2", "xsystem35", "https://github.com/kichikuou/xsystem35-sdl2"),
Entry("SDL", "SDL", "https://www.libsdl.org/"),
Entry("SDL_mixer", "SDL_mixer", "https://github.com/libsdl-org/SDL_mixer"),
Entry("SDL_ttf", "SDL_ttf", "https://github.com/libsdl-org/SDL_ttf"),
Entry("FreeType", "freetype", "https://freetype.org/"),
Entry("HarfBuzz", "harfbuzz", "https://harfbuzz.github.io/"),
Entry("MotoyaLCedar W3 mono", "MTLc3m", "https://github.com/aosp-mirror/platform_frameworks_base/tree/lollipop-release/data/fonts"),
Entry("Source Han Serif", "mincho", "https://github.com/adobe-fonts/source-han-serif/"),
)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_licenses_menu)
val items = entries.map { mapOf("name" to it.displayName, "url" to it.url)}
val listView = findViewById<ListView>(R.id.list)
listView.adapter = SimpleAdapter(this, items, android.R.layout.simple_list_item_2,
arrayOf("name", "url"), intArrayOf(android.R.id.text1, android.R.id.text2))
listView.setOnItemClickListener { _, _, pos, _ ->
val intent = Intent(this, LicensesActivity::class.java).apply {
putExtra(LicensesActivity.EXTRA_DISPLAY_NAME, entries[pos].displayName)
putExtra(LicensesActivity.EXTRA_FILE_NAME, entries[pos].fileName)
}
startActivity(intent)
}
}
}
@@ -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);
@@ -248,7 +248,11 @@ public class HIDDeviceManager {
0x1689, // Razer Onza
0x1949, // Lab126, Inc.
0x1bad, // Harmonix
0x20d6, // PowerA
0x24c6, // PowerA
0x2c22, // Qanba
0x2dc8, // 8BitDo
0x9886, // ASTRO Gaming
};
if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
@@ -269,12 +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
0x2e24, // Hyperkin
};
@@ -349,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;
}
@@ -520,7 +529,7 @@ public class HIDDeviceManager {
for (HIDDevice device : mDevicesById.values()) {
device.setFrozen(frozen);
}
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -569,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;
}
File diff suppressed because it is too large Load Diff
@@ -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);
}
}
}
@@ -255,23 +281,21 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
@Override
public boolean handleMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) != 0) {
int actionPointerIndex = event.getActionIndex();
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_MOVE) {
SDLJoystick joystick = getJoystick(event.getDeviceId());
if (joystick != null) {
for (int i = 0; i < joystick.axes.size(); i++) {
InputDevice.MotionRange range = joystick.axes.get(i);
/* Normalize the value to -1...1 */
float value = (event.getAxisValue(range.getAxis(), actionPointerIndex) - range.getMin()) / range.getRange() * 2.0f - 1.0f;
SDLControllerManager.onNativeJoy(joystick.device_id, i, value);
}
for (int i = 0; i < joystick.hats.size() / 2; i++) {
int hatX = Math.round(event.getAxisValue(joystick.hats.get(2 * i).getAxis(), actionPointerIndex));
int hatY = Math.round(event.getAxisValue(joystick.hats.get(2 * i + 1).getAxis(), actionPointerIndex));
SDLControllerManager.onNativeHat(joystick.device_id, i, hatX, hatY);
}
int actionPointerIndex = event.getActionIndex();
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_MOVE) {
SDLJoystick joystick = getJoystick(event.getDeviceId());
if (joystick != null) {
for (int i = 0; i < joystick.axes.size(); i++) {
InputDevice.MotionRange range = joystick.axes.get(i);
/* Normalize the value to -1...1 */
float value = (event.getAxisValue(range.getAxis(), actionPointerIndex) - range.getMin()) / range.getRange() * 2.0f - 1.0f;
SDLControllerManager.onNativeJoy(joystick.device_id, i, value);
}
for (int i = 0; i < joystick.hats.size() / 2; i++) {
int hatX = Math.round(event.getAxisValue(joystick.hats.get(2 * i).getAxis(), actionPointerIndex));
int hatY = Math.round(event.getAxisValue(joystick.hats.get(2 * i + 1).getAxis(), actionPointerIndex));
SDLControllerManager.onNativeHat(joystick.device_id, i, hatX, hatY);
}
}
}
@@ -293,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;
}
@@ -310,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;
@@ -319,6 +383,7 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 {
KeyEvent.KEYCODE_BUTTON_X,
KeyEvent.KEYCODE_BUTTON_Y,
KeyEvent.KEYCODE_BACK,
KeyEvent.KEYCODE_MENU,
KeyEvent.KEYCODE_BUTTON_MODE,
KeyEvent.KEYCODE_BUTTON_START,
KeyEvent.KEYCODE_BUTTON_THUMBL,
@@ -360,6 +425,7 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 {
(1 << 2), // X -> X
(1 << 3), // Y -> Y
(1 << 4), // BACK -> BACK
(1 << 6), // MENU -> START
(1 << 5), // MODE -> GUIDE
(1 << 6), // START -> START
(1 << 7), // THUMBL -> LEFTSTICK
@@ -560,8 +626,6 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener {
switch ( event.getSource() ) {
case InputDevice.SOURCE_JOYSTICK:
case InputDevice.SOURCE_GAMEPAD:
case InputDevice.SOURCE_DPAD:
return SDLControllerManager.handleJoystickMotionEvent(event);
case InputDevice.SOURCE_MOUSE:
@@ -691,8 +755,6 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
switch ( event.getSource() ) {
case InputDevice.SOURCE_JOYSTICK:
case InputDevice.SOURCE_GAMEPAD:
case InputDevice.SOURCE_DPAD:
return SDLControllerManager.handleJoystickMotionEvent(event);
case InputDevice.SOURCE_MOUSE:
@@ -747,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
@@ -757,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 {
@@ -0,0 +1,405 @@
package org.libsdl.app;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Build;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.WindowManager;
/**
SDLSurface. This is what we draw on, so we need to know when it's created
in order to do anything useful.
Because of this, that's where we set up the SDL thread
*/
public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
View.OnKeyListener, View.OnTouchListener, SensorEventListener {
// Sensors
protected SensorManager mSensorManager;
protected Display mDisplay;
// Keep track of the surface size to normalize touch events
protected float mWidth, mHeight;
// Is SurfaceView ready for rendering
public boolean mIsSurfaceReady;
// Startup
public SDLSurface(Context context) {
super(context);
getHolder().addCallback(this);
setFocusable(true);
setFocusableInTouchMode(true);
requestFocus();
setOnKeyListener(this);
setOnTouchListener(this);
mDisplay = ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
setOnGenericMotionListener(SDLActivity.getMotionListener());
// Some arbitrary defaults to avoid a potential division by zero
mWidth = 1.0f;
mHeight = 1.0f;
mIsSurfaceReady = false;
}
public void handlePause() {
enableSensor(Sensor.TYPE_ACCELEROMETER, false);
}
public void handleResume() {
setFocusable(true);
setFocusableInTouchMode(true);
requestFocus();
setOnKeyListener(this);
setOnTouchListener(this);
enableSensor(Sensor.TYPE_ACCELEROMETER, true);
}
public Surface getNativeSurface() {
return getHolder().getSurface();
}
// Called when we have a valid drawing surface
@Override
public void surfaceCreated(SurfaceHolder holder) {
Log.v("SDL", "surfaceCreated()");
SDLActivity.onNativeSurfaceCreated();
}
// Called when we lose the surface
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.v("SDL", "surfaceDestroyed()");
// Transition to pause, if needed
SDLActivity.mNextNativeState = SDLActivity.NativeState.PAUSED;
SDLActivity.handleNativeState();
mIsSurfaceReady = false;
SDLActivity.onNativeSurfaceDestroyed();
}
// Called when the surface is resized
@Override
public void surfaceChanged(SurfaceHolder holder,
int format, int width, int height) {
Log.v("SDL", "surfaceChanged()");
if (SDLActivity.mSingleton == null) {
return;
}
mWidth = width;
mHeight = height;
int nDeviceWidth = width;
int nDeviceHeight = height;
try
{
if (Build.VERSION.SDK_INT >= 17 /* Android 4.2 (JELLY_BEAN_MR1) */) {
DisplayMetrics realMetrics = new DisplayMetrics();
mDisplay.getRealMetrics( realMetrics );
nDeviceWidth = realMetrics.widthPixels;
nDeviceHeight = realMetrics.heightPixels;
}
} catch(Exception ignored) {
}
synchronized(SDLActivity.getContext()) {
// In case we're waiting on a size change after going fullscreen, send a notification.
SDLActivity.getContext().notifyAll();
}
Log.v("SDL", "Window size: " + width + "x" + height);
Log.v("SDL", "Device size: " + nDeviceWidth + "x" + nDeviceHeight);
SDLActivity.nativeSetScreenResolution(width, height, nDeviceWidth, nDeviceHeight, mDisplay.getRefreshRate());
SDLActivity.onNativeResize();
// Prevent a screen distortion glitch,
// for instance when the device is in Landscape and a Portrait App is resumed.
boolean skip = false;
int requestedOrientation = SDLActivity.mSingleton.getRequestedOrientation();
if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT || requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT) {
if (mWidth > mHeight) {
skip = true;
}
} else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE) {
if (mWidth < mHeight) {
skip = true;
}
}
// Special Patch for Square Resolution: Black Berry Passport
if (skip) {
double min = Math.min(mWidth, mHeight);
double max = Math.max(mWidth, mHeight);
if (max / min < 1.20) {
Log.v("SDL", "Don't skip on such aspect-ratio. Could be a square resolution.");
skip = false;
}
}
// Don't skip in MultiWindow.
if (skip) {
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;
}
}
}
if (skip) {
Log.v("SDL", "Skip .. Surface is not ready.");
mIsSurfaceReady = false;
return;
}
/* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */
SDLActivity.onNativeSurfaceChanged();
/* Surface is ready */
mIsSurfaceReady = true;
SDLActivity.mNextNativeState = SDLActivity.NativeState.RESUMED;
SDLActivity.handleNativeState();
}
// Key events
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
return SDLActivity.handleKeyEvent(v, keyCode, event, null);
}
// Touch events
@Override
public boolean onTouch(View v, MotionEvent event) {
/* Ref: http://developer.android.com/training/gestures/multi.html */
int touchDevId = event.getDeviceId();
final int pointerCount = event.getPointerCount();
int action = event.getActionMasked();
int pointerFingerId;
int i = -1;
float x,y,p;
/*
* Prevent id to be -1, since it's used in SDL internal for synthetic events
* Appears when using Android emulator, eg:
* adb shell input mouse tap 100 100
* adb shell input touchscreen tap 100 100
*/
if (touchDevId < 0) {
touchDevId -= 1;
}
// 12290 = Samsung DeX mode desktop mouse
// 12290 = 0x3002 = 0x2002 | 0x1002 = SOURCE_MOUSE | SOURCE_TOUCHSCREEN
// 0x2 = SOURCE_CLASS_POINTER
if (event.getSource() == InputDevice.SOURCE_MOUSE || event.getSource() == (InputDevice.SOURCE_MOUSE | InputDevice.SOURCE_TOUCHSCREEN)) {
int mouseButton = 1;
try {
Object object = event.getClass().getMethod("getButtonState").invoke(event);
if (object != null) {
mouseButton = (Integer) object;
}
} catch(Exception ignored) {
}
// We need to check if we're in relative mouse mode and get the axis offset rather than the x/y values
// if we are. We'll leverage our existing mouse motion listener
SDLGenericMotionListener_API12 motionListener = SDLActivity.getMotionListener();
x = motionListener.getEventX(event);
y = motionListener.getEventY(event);
SDLActivity.onNativeMouse(mouseButton, action, x, y, motionListener.inRelativeMode());
} else {
switch(action) {
case MotionEvent.ACTION_MOVE:
for (i = 0; i < pointerCount; i++) {
pointerFingerId = event.getPointerId(i);
x = event.getX(i) / mWidth;
y = event.getY(i) / mHeight;
p = event.getPressure(i);
if (p > 1.0f) {
// may be larger than 1.0f on some devices
// see the documentation of getPressure(i)
p = 1.0f;
}
SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_DOWN:
// Primary pointer up/down, the index is always zero
i = 0;
/* fallthrough */
case MotionEvent.ACTION_POINTER_UP:
case MotionEvent.ACTION_POINTER_DOWN:
// Non primary pointer up/down
if (i == -1) {
i = event.getActionIndex();
}
pointerFingerId = event.getPointerId(i);
x = event.getX(i) / mWidth;
y = event.getY(i) / mHeight;
p = event.getPressure(i);
if (p > 1.0f) {
// may be larger than 1.0f on some devices
// see the documentation of getPressure(i)
p = 1.0f;
}
SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
break;
case MotionEvent.ACTION_CANCEL:
for (i = 0; i < pointerCount; i++) {
pointerFingerId = event.getPointerId(i);
x = event.getX(i) / mWidth;
y = event.getY(i) / mHeight;
p = event.getPressure(i);
if (p > 1.0f) {
// may be larger than 1.0f on some devices
// see the documentation of getPressure(i)
p = 1.0f;
}
SDLActivity.onNativeTouch(touchDevId, pointerFingerId, MotionEvent.ACTION_UP, x, y, p);
}
break;
default:
break;
}
}
return true;
}
// Sensor events
public void enableSensor(int sensortype, boolean enabled) {
// TODO: This uses getDefaultSensor - what if we have >1 accels?
if (enabled) {
mSensorManager.registerListener(this,
mSensorManager.getDefaultSensor(sensortype),
SensorManager.SENSOR_DELAY_GAME, null);
} else {
mSensorManager.unregisterListener(this,
mSensorManager.getDefaultSensor(sensortype));
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// TODO
}
@Override
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
// Since we may have an orientation set, we won't receive onConfigurationChanged events.
// We thus should check here.
int newOrientation;
float x, y;
switch (mDisplay.getRotation()) {
case Surface.ROTATION_90:
x = -event.values[1];
y = event.values[0];
newOrientation = SDLActivity.SDL_ORIENTATION_LANDSCAPE;
break;
case Surface.ROTATION_270:
x = event.values[1];
y = -event.values[0];
newOrientation = SDLActivity.SDL_ORIENTATION_LANDSCAPE_FLIPPED;
break;
case Surface.ROTATION_180:
x = -event.values[0];
y = -event.values[1];
newOrientation = SDLActivity.SDL_ORIENTATION_PORTRAIT_FLIPPED;
break;
case Surface.ROTATION_0:
default:
x = event.values[0];
y = event.values[1];
newOrientation = SDLActivity.SDL_ORIENTATION_PORTRAIT;
break;
}
if (newOrientation != SDLActivity.mCurrentOrientation) {
SDLActivity.mCurrentOrientation = newOrientation;
SDLActivity.onNativeOrientationChanged(newOrientation);
}
SDLActivity.onNativeAccel(-x / SensorManager.GRAVITY_EARTH,
y / SensorManager.GRAVITY_EARTH,
event.values[2] / SensorManager.GRAVITY_EARTH);
}
}
// Captured pointer events for API 26.
public boolean onCapturedPointerEvent(MotionEvent event)
{
int action = event.getActionMasked();
float x, y;
switch (action) {
case MotionEvent.ACTION_SCROLL:
x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, 0);
y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, 0);
SDLActivity.onNativeMouse(0, action, x, y, false);
return true;
case MotionEvent.ACTION_HOVER_MOVE:
case MotionEvent.ACTION_MOVE:
x = event.getX(0);
y = event.getY(0);
SDLActivity.onNativeMouse(0, action, x, y, true);
return true;
case MotionEvent.ACTION_BUTTON_PRESS:
case MotionEvent.ACTION_BUTTON_RELEASE:
// Change our action value to what SDL's code expects.
if (action == MotionEvent.ACTION_BUTTON_PRESS) {
action = MotionEvent.ACTION_DOWN;
} else { /* MotionEvent.ACTION_BUTTON_RELEASE */
action = MotionEvent.ACTION_UP;
}
x = event.getX(0);
y = event.getY(0);
int button = event.getButtonState();
SDLActivity.onNativeMouse(button, action, x, y, true);
return true;
}
return false;
}
}
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:id="@+id/license_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="20dp" />
</ScrollView>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:padding="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ProgressBar
android:layout_marginEnd="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="16sp"/>
</LinearLayout>
@@ -6,4 +6,7 @@
<item
android:id="@+id/import_savedata"
android:title="@string/action_import_save_data" />
<item
android:id="@+id/licenses"
android:title="@string/action_licenses" />
</menu>
@@ -3,6 +3,7 @@
<string name="app_name">xsystem35</string>
<string name="action_export_save_data">セーブデータをエクスポート</string>
<string name="action_import_save_data">セーブデータをインポート</string>
<string name="action_licenses">オープンソースライセンス</string>
<string name="cancel">キャンセル</string>
<string name="cannot_find_ald">System 3.x のファイル (*.ald) が見つかりません。</string>
<string name="choose_a_file">ファイルを選択</string>
@@ -2,6 +2,7 @@
<string name="app_name">xsystem35</string>
<string name="action_export_save_data">Export Save Files</string>
<string name="action_import_save_data">Import Save Files</string>
<string name="action_licenses">Open source licenses</string>
<string name="cancel">Cancel</string>
<string name="cannot_find_ald">Cannot find System 3.x game files (*.ald).</string>
<string name="choose_a_file">Choose a file</string>
+2 -3
View File
@@ -1,14 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.6.20'
ext.kotlin_version = '1.7.21'
repositories {
mavenCentral()
google()
}
dependencies {
// AGP 7.1.x cannot be used due to https://issuetracker.google.com/issues/206099937
classpath 'com.android.tools.build:gradle:7.0.4'
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
View File
@@ -1,6 +1,6 @@
#Thu Nov 11 18:20:34 PST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
+2 -2
View File
@@ -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 -1
View File
@@ -1,5 +1,5 @@
#cmakedefine PACKAGE "@PACKAGE@"
#define VERSION "2.5.0"
#define VERSION "2.10.0"
#cmakedefine CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
-189
View File
@@ -1,189 +0,0 @@
それぞれのゲームに付いての注意書き
[鬼畜王ランス]
[ランス4(for Win95)]
[闘神都市2(for Win95)]
[いけないかつみ先生]
= 外字データには対応していません
[かえるにょぱにょ〜ん]
= フロアデータ(floor_1.map 〜 floor_16.map) はセーブデータと同じディレク
トリに置いてください。
= 一部のキャラの絵と説明が違う(金魚と????)
[戦巫女]
= 戦巫女は2枚組のCDで、Windows版では一部のデータをCD-ROMに置いたままゲーム
することになっていますが、xsystem35 では CD-Audio と CD-ROM上のデータを
同時に使用することは出来ません。ハードディスク等に全てのデータをインス
トールするか、あるいは CD-Audio 以外の演奏方法(MP3等)を使用してください。
CD-Audio を使う場合は2枚目の CD に音楽データが入っています。
[零式(アリスの館456版)]
= マップデータ(MAP_DATA.DAT, UR_DATA.DATA)はセーブデータと同じディレクトリに
置いてください。
[ATLACH=NACHA(アリスの館456版)]
[人間狩り(アリスの館456版)]
[アリスの館456]
- DALK
- 闘神都市
- DrStop!
- ランス1
- ランス2
- ランス3
[王道勇者]
[ディアボリカ]
[AmbivalenZ(for Win95)]
[夢幻泡影 (for Win95)]
[ぱすてるチャイム]
= ぱすてるチャイムでは明らかにシナリオにおかしいところがあります。
そこで、これに対するパッチを作成しました。
patch というディレクトリの下に pastel.diff というパッチ当てのスクリプト
がありますので、ゲームのシナリオデータのあるディレクトリにコピーして
そのディレクトリに移動した後、 ./pastel.diff (シナリオファイル名) と
実行してください。
(例)
> ./pastel.diff pastel_sa.ald
古いデータは pastel_sa.ald.org として保存されます。
シナリオデータは Ver 1.00 と Ver 1.01 に適用できます。
(廉価版では直っている?)
[ぷろすちゅーでんとGood]
[守り神様]
[ママトト]
[HushByBaby]
[Darcrows]
[PERSIOM]
= DirectSound(3D Sound) には対応していません。
[隠れ月]
[SeeIn青]
[廉価版・デアボリカ]
[廉価版・アトラクナクア]
[廉価版・かえるにょ・ぱにょん]
[廉価版・零式]
[かえるにょ国にょありす(20世紀アリス)]
= 外部MIDIプレイヤーモードでは音楽がリピートされません。
[これDPS?(20世紀アリス)]
[夜が来る!]
= 動きません
[王子さま Lv1]
[Only You 〜リ・クルス〜]
[大悪司]
= オープニングが動かない
[王子さま Lv1.5]
[妻みぐい]
= オープニングが動かない
[エスカレイヤー]
= オープニングが動かない
[Rance5D]
[妻みぐい2]
= オープニングが動かない
[DALK外伝]
[ままにょにょ]
= System4につき動きません
/*
* その他
*/
* センチメンタルシーズン (Aliceの館 CDをベースに UNITBASE が移植したもの)
= http://www4.big.or.jp/~unitbase/sys35sdk/games.html
* Intruder (Aliceの館 CDをベースに UNITBASE が移植したもの)
= まだ完了していません
* Crecent Moon がぁる (Aliceの館 CDをベースに UNITBASE が移植したもの)
= http://www4.big.or.jp/~unitbase/sys35sdk/games.html
* あぶない天狗伝説 (Aliceの館 CD2をベースに UNITBASE が移植したもの)
= 掲載許可が下りません
* OnlyYou (system3版をベースに TOTOさんが移植したもの)
= http://www1.interq.or.jp/t-takeda/index.html
* ランス4.1 (system3版をベースに TOTOさんが移植したもの)
= http://www1.interq.or.jp/t-takeda/index.html
= スプライトの色がおかしい
* ランス4.2 (system3版をベースに TOTOさんが移植したもの
= http://www1.interq.or.jp/t-takeda/index.html
= スプライトの色がおかしい
* アリスの館3 (system3版をベースに TOTOさんが移植したもの)
= http://www1.interq.or.jp/t-takeda/index.html
* 乙女戦記 (system3版をベースに TOTOさんが移植したもの)
= http://www1.interq.or.jp/t-takeda/index.html
* 闘神都市2外伝 (system3版をベースに TOTOさんが移植したもの)
= http://www1.interq.or.jp/t-takeda/index.html
* DPS全部 (system3版をベースに TOTOさんが移植したもの)
= http://www1.interq.or.jp/t-takeda/index.html
* ProStudentG (system3版をベースに TOTOさんが移植したもの)
= http://www1.interq.or.jp/t-takeda/index.html
* 学園KING (AliceCD Ver 1.??)
= CDが鳴らない
-> TOTOさんが、CD-DAに対応するためのシナリオパッチをつくっています。
http://www1.interq.or.jp/t-takeda/midi.html
* メイドのススメ (AliceCD Ver 1.02)
* ぶろぶろ (AliceCD Ver 1.02)
* 学園漂流戦記 (AliceCD Ver 1.02)
* 扉 (AliceCD Ver 2.02)
* 妖精 (AliceCD Ver 2.02)
/*
* 3rd party 製作 ゲーム
*/
#include "MISCGAME.TXT"
-58
View File
@@ -1,58 +0,0 @@
その他の SYSTEM 3.5 のゲームについて
README にある動作確認ゲーム以外にも、ネット上で公開されているSYSTEM3.5対応
のゲームのうち幾つかは動く事が確認されています。ここでは 1.4.0 preX での動作
状況です。1.4.0 公開時点で手に入るゲームを順次追加していっています。
また、XXXが動かないんだけど調べてください、XXXはちゃんと動きました、といった
情報もおよせください。
OKは問題なく動く。GOODが多少の問題あるもののゲームをやるぶんで気にはなるけど
耐えられる範囲のもの。BADは動かないものです。
(作者の敬称略)
【 ソフト名 】 【 ファイル名 】【 作者名 】【 動作 】
国立ファーブル図
書館司書〜
ブックルちゃん〜 SSYO_100.LZH 大塚ヒロ OK
バルーンぽっぷ BPOP_093.LZH 大塚ヒロ OK
Self self.lzh よこやまなおき OK
おせろっと othellotto.exe よこやまなおき OK
キャロル carol.lzh よこやまなおき GOOD(1)
積層四目並べ Te1.lzh 深叢 忍 OK
16Piece Puzzle 16p1.lzh 深叢 忍 OK
The Line Line0.lzh 深叢 忍 OK
Black Jack bj120.lzh かずき OK
マスカレイド (in AliceCD202) ちあぼう OK
戦娘ver2.12 ikusa212.lzh ちあぼう OK
できるかなー! (in AliceCD202) KIMM SOFT OK(2)
恋は計算どおり♪ koi.lzh SS OK
動体視力を鍛えるにょ game_191.lzh LazyRichField BAD(3)
集中力を鍛えるにょ game_22.lh LazyRichField GOOD(4)
1) 雪が降らない (grDrawFillCircle が未実装)
通信対戦が出来ない
2) メッセージサイズ300ドットの表示は 100 ドットに制限しています
3) DS 数字 となっている
4) 色がおかしい
最後にこれらのデータを公開している作者の方々のURLです。
大塚ヒロさん http://www.studioHIRO.com/
よこやまなおきさん http://www3.justnet.ne.jp/~naoki-yokoyama/
深叢 忍さん http://www2s.biglobe.ne.jp/~nin/
かずきさん http://www.din.or.jp/~kazuki/
桐ヶ屋 inc.(ちあぼう)さん http://www.eucaly.net/~kiri
KIMM SOFT/ネリワサヴィちーむ heavyd@syd.odn.ne.jp
SSさん http://www.sspzgr.net/
LazyRichFieldさん http://www2j.biglobe.ne.jp/~Lazy/staff/alice.htm
+83
View File
@@ -0,0 +1,83 @@
Game Compatibility
==================
| Game | Status | Notes |
| ------------------------------------------- | ----------- | ----- |
| 鬼畜王ランス | Supported | |
| Kichikuou Rance (EN) | Supported | |
| RanceIV -教団の遺産- | Supported | Win95 edition, [Ver2.05](https://hannylaboratory.blogspot.com/2023/01/blog-post_26.html) |
| Rance4 -Legacy of the Sect- (EN) | Supported | |
| 兰斯IV -教团的遗产- (CN) | Supported | |
| ランス4.1 | Supported | [Ver1.05](https://hannylaboratory.blogspot.com/2023/02/blog-post_9.html) |
| ランス4.2 | Supported | [Ver1.05](https://hannylaboratory.blogspot.com/2023/02/blog-post_9.html) |
| いけないかつみ先生 | Supported | Emojis are not supported |
| 闘神都市II | Supported | Win95 edition |
| かえるにょ・ぱにょ~ん | Supported | Normal / Low-priced edition |
| 戦巫女 | Supported | Normal / Low-priced edition |
| 零式 | Supported | From ALICEの館4・5・6 / Low-priced edition |
| アトラク=ナクア | Supported | From ALICEの館4・5・6 / Low-priced edition |
| Rance -光を求めて- | Supported | From ALICEの館4・5・6 |
| Rance II -反逆の少女達- | Supported | From ALICEの館4・5・6 |
| Rance III -リーザス陥落- | Supported | From ALICEの館4・5・6 |
| DALK | Supported | From ALICEの館4・5・6 |
| 闘神都市 | Supported | From ALICEの館4・5・6 |
| Dr.STOP | Supported | From ALICEの館4・5・6 |
| 人間狩り | Supported | From ALICEの館4・5・6 / アリスCD |
| 女の子図鑑 | Unknown | From ALICEの館4・5・6 |
| 恋のおわり | Unknown | |
| 王道勇者 | Supported | |
| AmbivalenZ | Supported | Win95 edition |
| DiaboLiQuE | Supported | Normal / Low-priced edition |
| 夢幻泡影 | Unknown | Win98 edition |
| ぱすてるチャイム | Supported | See [patch/README.TXT](patch/README.TXT) |
| ぷろすちゅーでんとGood | Supported | |
| 守り神様 | Supported | |
| ママトト | Supported | |
| HUSHABY BABY | Supported | |
| DARCROWS | Supported | |
| 隠れ月 | Supported | |
| PERSIOM | Supported | 3D sound is not supported |
| SeeIn青 | Supported | |
| かえるにょ国にょアリス | Supported | From 20世紀アリス |
| これD・P・S? | Supported | From 20世紀アリス |
| 夜が来る! | Unsupported | |
| Only you ~リ・クルス~ | Supported | |
| 大悪司 | Supported | Opening demo is not supported |
| 王子さまLv1 | Supported | |
| 王子さま1ヵ月後 | Supported | From 王子さまLV1.5 |
| 白鳳の子分叩き | Supported | From 王子さまLV1.5 |
| チェシャのお部屋1.5 | Supported | From 王子さまLV1.5 |
| 王子さま1/16 | Supported | From 王子さまLV1.5 |
| スパイ伊藤の「クイズ!俺にさぼらせろ」 | Supported | From 王子さまLV1.5 |
| 妻みぐい | Supported | Opening demo is not supported |
| 超昂天使エスカレイヤー | Supported | Opening demo is not supported |
| ランス5D | Supported | |
| Rance 5D - The Lonely Girl (MangaGamer) | Supported | |
| 俺の下であがけ | Unknown | |
| 楽園行 | Unknown | |
| 妻みぐい2 | Supported | Opening demo is not supported |
| シェル・クレイル | Supported | |
| ナイトデーモン | Supported | |
| 学園KING | Supported | From アリスCD |
| 学園KING 番外編 | Supported | From アリスCD |
| 蒼海に墜ちて | Supported | From アリスCD |
| ぶろぶろ | Supported | From アリスCD |
| 裸ぶろぶろ狂 | Supported | From アリスCD |
| メイドのススメ | Supported | From アリスCD |
| 学園漂流戦記 | Supported | From アリスCD |
| 学園漂流戦記2 | Supported | From アリスCD |
| 当たって!!KUDAKERO 予告編 | Supported | From アリスCD |
| 妖精 | Supported | From アリスCD |
| [扉] | Supported | From アリスCD |
| 叩き殺し太郎 | Supported | From アリスCD |
| バルーンぽっぷ | Supported | From アリスCD |
| 高速ひよこ2 | Supported | From アリスCD |
| おせろっと | Supported | From アリスCD |
| マスカレイド | Supported | From アリスCD |
| キャロル ~聖なる鐘が響く夜~ | Supported | From アリスCD, Online match is not supported |
| できるかなー? | Supported | From アリスCD |
| Child Assassin | Supported | From アリスCD |
| Klavier | Supported | From アリスCD |
| 弱肉狂食 | Supported | From アリスCD |
| 眼鏡大戦2 | Supported | From アリスCD |
| 妄想くん | Supported | From アリスCD |
+3 -3
View File
@@ -16,21 +16,21 @@ static void Init() {
*var = 1;
DEBUG_COMMAND_YET("AliceLogo.Init %d,%d,%d,%p:\n", p1, p2, p3, var);
DEBUG_COMMAND_YET("AliceLogo.Init %d,%d,%d,%p:", p1, p2, p3, var);
}
static void SetWaveNum() {
int p1 = getCaliValue();
int p2 = getCaliValue();
DEBUG_COMMAND_YET("AliceLogo.SetWaveNum %d,%d:\n", p1, p2);
DEBUG_COMMAND_YET("AliceLogo.SetWaveNum %d,%d:", p1, p2);
}
static void Run() {
int p1 = getCaliValue();
int p2 = getCaliValue();
DEBUG_COMMAND_YET("AliceLogo.Run %d,%d:\n", p1, p2);
DEBUG_COMMAND_YET("AliceLogo.Run %d,%d:", p1, p2);
}
static const ModuleFunc functions[] = {
-1
View File
@@ -26,7 +26,6 @@ add_library(modules STATIC
SACT/SACT.c
SACT/sactcg.c
SACT/sactsound.c
SACT/sactbgm.c
SACT/sacttimer.c
SACT/sactstring.c
SACT/sactcrypto.c
+4 -4
View File
@@ -10,7 +10,7 @@
static void Init() {
int p1 = getCaliValue();
DEBUG_COMMAND_YET("Confirm.Init %d:\n", p1);
DEBUG_COMMAND_YET("Confirm.Init %d:", p1);
}
static void ExistKeyFile() {
@@ -20,7 +20,7 @@ static void ExistKeyFile() {
*var = 1;
DEBUG_COMMAND_YET("Confirm.ExistKeyFile %s,%p,%p:\n",p1, p2, var);
DEBUG_COMMAND_YET("Confirm.ExistKeyFile %s,%p,%p:",p1, p2, var);
}
static void CheckProtectFile() {
@@ -30,7 +30,7 @@ static void CheckProtectFile() {
*var = 1;
DEBUG_COMMAND_YET("Confirm.CheckProtectFile %s,%p,%p:\n", p1,p2,var);
DEBUG_COMMAND_YET("Confirm.CheckProtectFile %s,%p,%p:", p1,p2,var);
}
static void CreateKeyFile() {
@@ -40,7 +40,7 @@ static void CreateKeyFile() {
*var = 1;
DEBUG_COMMAND_YET("Confirm.CreateKeyFile %s,%p,%p:\n", p1,p2,var);
DEBUG_COMMAND_YET("Confirm.CreateKeyFile %s,%p,%p:", p1,p2,var);
}
static const ModuleFunc functions[] = {
+54 -54
View File
@@ -113,7 +113,7 @@ static int load_cg_main(int no) {
int sno;
if (sf == NULL) {
WARNING("load fail(cg==NULL,no=%d)\n", no);
WARNING("load fail(cg==NULL,no=%d)", no);
return 0;
}
@@ -136,7 +136,7 @@ static void Init() {
// surface0 を pre_freesurfno として返さないように。
pre_freesurfno = 1;
DEBUG_COMMAND("Gpx.Init %d:\n", p1);
DEBUG_COMMAND("Gpx.Init %d:", p1);
}
static void Gpx_reset(void) {
@@ -171,7 +171,7 @@ static void Create() {
suf[no] = s;
}
DEBUG_COMMAND("Gpx.Create %p,%d,%d,%d:\n", var, width, height, bpp);
DEBUG_COMMAND("Gpx.Create %p,%d,%d,%d:", var, width, height, bpp);
}
static void CreatePixelOnly() {
@@ -199,7 +199,7 @@ static void CreatePixelOnly() {
suf[no] = s;
}
DEBUG_COMMAND("Gpx.CreatePixelOnly %d,%d,%d,%d:\n", *var, width, height, bpp);
DEBUG_COMMAND("Gpx.CreatePixelOnly %d,%d,%d,%d:", *var, width, height, bpp);
}
static void CreateAMapOnly() {
@@ -225,7 +225,7 @@ static void CreateAMapOnly() {
suf[no] = s;
}
DEBUG_COMMAND("Gpx.CreateAMapOnly %p,%d,%d:\n", var, width, height);
DEBUG_COMMAND("Gpx.CreateAMapOnly %p,%d,%d:", var, width, height);
}
static void IsSurface() {
@@ -248,7 +248,7 @@ static void IsSurface() {
*var = (s->alpha && s->pixel) ? 1 : 0;
}
DEBUG_COMMAND("Gpx.IsSurface %d,%p:\n", p1, var);
DEBUG_COMMAND("Gpx.IsSurface %d,%p:", p1, var);
}
static void IsPixel() {
@@ -270,7 +270,7 @@ static void IsPixel() {
*var = s->pixel ? 1 : 0;
}
DEBUG_COMMAND("Gpx.IsPixel %d,%p:\n", p1, var);
DEBUG_COMMAND("Gpx.IsPixel %d,%p:", p1, var);
}
static void IsAlpha() {
@@ -292,7 +292,7 @@ static void IsAlpha() {
*var = s->alpha ? 1 : 0;
}
DEBUG_COMMAND("Gpx.IsAlpha %d,%p:\n", p1, var);
DEBUG_COMMAND("Gpx.IsAlpha %d,%p:", p1, var);
}
static void GetWidth() {
@@ -314,7 +314,7 @@ static void GetWidth() {
*var = s->width;
}
DEBUG_COMMAND("Gpx.GetWidth %d,%d:\n", p1, *var);
DEBUG_COMMAND("Gpx.GetWidth %d,%d:", p1, *var);
}
static void GetHeight() {
@@ -336,13 +336,13 @@ static void GetHeight() {
*var = s->height;
}
DEBUG_COMMAND("Gpx.GetHeight %d,%d:\n", p1, *var);
DEBUG_COMMAND("Gpx.GetHeight %d,%d:", p1, *var);
}
static void GetCreatedSurface() { /* not used ? */
int *var = getCaliVariable();
DEBUG_COMMAND_YET("Gpx.GetCreatedSurface %p:\n", var);
DEBUG_COMMAND_YET("Gpx.GetCreatedSurface %p:", var);
}
static void LoadCG() {
@@ -357,21 +357,21 @@ static void LoadCG() {
*var = load_cg_main(p1 -1);
DEBUG_COMMAND("Gpx.LoadCG %p,%d (%d):\n", var, p1, *var);
DEBUG_COMMAND("Gpx.LoadCG %p,%d (%d):", var, p1, *var);
}
static void GetCGPosX() { /* not useed ? */
int *var = getCaliVariable();
int p1 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.GetCgPosX %p,%d:\n", var, p1);
DEBUG_COMMAND_YET("Gpx.GetCgPosX %p,%d:", var, p1);
}
static void GetCGPosY() { /* not useed ? */
int *var = getCaliVariable();
int p1 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.GetCgPosY %p,%d:\n", var, p1);
DEBUG_COMMAND_YET("Gpx.GetCgPosY %p,%d:", var, p1);
}
static void Free() {
@@ -382,7 +382,7 @@ static void Free() {
*/
int p1 = getCaliValue();
DEBUG_COMMAND("Gpx.Free %d:\n", p1);
DEBUG_COMMAND("Gpx.Free %d:", p1);
if (p1 != 0) {
sf_free_one(p1);
@@ -395,7 +395,7 @@ static void FreeAll() {
*/
sf_free_all();
DEBUG_COMMAND("Gpx.FreeAll:\n");
DEBUG_COMMAND("Gpx.FreeAll:");
}
static void Copy() {
@@ -421,7 +421,7 @@ static void Copy() {
int sh = getCaliValue();
surface_t *src, *dst;
DEBUG_COMMAND("Gpx.Copy %d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss, sx, sy, sw, sh);
DEBUG_COMMAND("Gpx.Copy %d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss, sx, sy, sw, sh);
src = sf_get(ss);
dst = sf_get(ds);
@@ -439,7 +439,7 @@ static void CopyBright() { /* not used ? */
int p8 = getCaliValue();
int p9 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.CopyBright %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9);
DEBUG_COMMAND_YET("Gpx.CopyBright %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
}
static void CopyAMap() {
@@ -465,7 +465,7 @@ static void CopyAMap() {
int sh = getCaliValue();
surface_t *src, *dst;
DEBUG_COMMAND("Gpx.CopyAMap %d,%d,%d,%d,%d,%d,%d,%d:\n", da, dx, dy, sa, sx, sy, sw, sh);
DEBUG_COMMAND("Gpx.CopyAMap %d,%d,%d,%d,%d,%d,%d,%d:", da, dx, dy, sa, sx, sy, sw, sh);
src = sf_get(sa);
dst = sf_get(da);
@@ -483,7 +483,7 @@ static void Blend() { /* not used ? */
int p8 = getCaliValue();
int p9 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.Blend %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9);
DEBUG_COMMAND_YET("Gpx.Blend %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
}
static void BlendSrcBright() { /* not used ? */
@@ -498,7 +498,7 @@ static void BlendSrcBright() { /* not used ? */
int p9 = getCaliValue();
int p10 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.BlendSrcBright %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
DEBUG_COMMAND_YET("Gpx.BlendSrcBright %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
}
static void BlendAddSatur() { /* not used ? */
@@ -511,7 +511,7 @@ static void BlendAddSatur() { /* not used ? */
int p7 = getCaliValue();
int p8 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.BlendAddStatur %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
DEBUG_COMMAND_YET("Gpx.BlendAddStatur %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
}
static void BlendAMap() {
@@ -537,7 +537,7 @@ static void BlendAMap() {
int sh = getCaliValue();
surface_t *src, *dst;
DEBUG_COMMAND("Gpx.BlendAMap %d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss, sx, sy, sw, sh);
DEBUG_COMMAND("Gpx.BlendAMap %d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss, sx, sy, sw, sh);
src = sf_get(ss);
dst = sf_get(ds);
@@ -554,7 +554,7 @@ static void BlendAMapSrcOnly() { /* not used ? */
int p7 = getCaliValue();
int p8 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.BlendAMapSrcOnly %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
DEBUG_COMMAND_YET("Gpx.BlendAMapSrcOnly %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
}
static void BlendAMapColor() { /* not used ? */
@@ -570,7 +570,7 @@ static void BlendAMapColor() { /* not used ? */
int p10 = getCaliValue();
int p11 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.BlendAMapColor %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
DEBUG_COMMAND_YET("Gpx.BlendAMapColor %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
}
static void BlendAMapColorAlpha() { /* not used ? */
@@ -587,7 +587,7 @@ static void BlendAMapColorAlpha() { /* not used ? */
int p11 = getCaliValue();
int p12 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.BlendAMapColorAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
DEBUG_COMMAND_YET("Gpx.BlendAMapColorAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
}
static void BlendAMapAlpha() { /* not used ? */
@@ -601,7 +601,7 @@ static void BlendAMapAlpha() { /* not used ? */
int p8 = getCaliValue();
int p9 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.BlendAMapAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9);
DEBUG_COMMAND_YET("Gpx.BlendAMapAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
}
static void BlendAMapBright() { /* not used ? */
@@ -615,7 +615,7 @@ static void BlendAMapBright() { /* not used ? */
int p8 = getCaliValue();
int p9 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.BlendAMapBright %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9);
DEBUG_COMMAND_YET("Gpx.BlendAMapBright %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
}
static void BlendAMapAlphaSrcBright() { /* not used ? */
@@ -630,7 +630,7 @@ static void BlendAMapAlphaSrcBright() { /* not used ? */
int p9 = getCaliValue();
int p10 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.BlendAMapBright %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
DEBUG_COMMAND_YET("Gpx.BlendAMapBright %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
}
static void BlendUseAMapColor() { /* not used ? */
@@ -647,7 +647,7 @@ static void BlendUseAMapColor() { /* not used ? */
int p11 = getCaliValue();
int p12 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.BlendUseAMapColor %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
DEBUG_COMMAND_YET("Gpx.BlendUseAMapColor %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
}
static void BlendScreen() { /* not used ? */
@@ -660,7 +660,7 @@ static void BlendScreen() { /* not used ? */
int p7 = getCaliValue();
int p8 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.BlendScreen %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
DEBUG_COMMAND_YET("Gpx.BlendScreen %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
}
static void BlendMultiply() { /* not used ? */
@@ -673,7 +673,7 @@ static void BlendMultiply() { /* not used ? */
int p7 = getCaliValue();
int p8 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.BlendMultiply %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
DEBUG_COMMAND_YET("Gpx.BlendMultiply %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
}
static void BlendScreenAlpha() { /* not used ? */
@@ -687,7 +687,7 @@ static void BlendScreenAlpha() { /* not used ? */
int p8 = getCaliValue();
int p9 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.BlendScreenAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9);
DEBUG_COMMAND_YET("Gpx.BlendScreenAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
}
static void Fill() {
@@ -713,7 +713,7 @@ static void Fill() {
int b = getCaliValue();
surface_t *dst;
DEBUG_COMMAND("Gpx.Fill %d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, r, g, b);
DEBUG_COMMAND("Gpx.Fill %d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, r, g, b);
dst = sf_get(ds);
gr_fill(dst, dx, dy, dw, dh, r, g, b);
@@ -731,7 +731,7 @@ static void FillAlphaColor() { /* not used ? */
int lv = getCaliValue();
surface_t *dst;
DEBUG_COMMAND_YET("Gpx.FillAlphaColor %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, r, g, b, lv);
DEBUG_COMMAND_YET("Gpx.FillAlphaColor %d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, r, g, b, lv);
dst = sf_get(ds);
gr_fill_alpha_color(dst, dx, dy, dw, dh, r, g, b, lv);
@@ -745,7 +745,7 @@ static void FillAMap() { /* not used ? */
int p5 = getCaliValue();
int p6 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.FillAMap %d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6);
DEBUG_COMMAND_YET("Gpx.FillAMap %d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6);
}
static void FillAMapOverBorder() {
@@ -770,7 +770,7 @@ static void FillAMapOverBorder() {
int d = getCaliValue();
surface_t *dst;
DEBUG_COMMAND("Gpx.FillAMapOverBorder %d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, s, d);
DEBUG_COMMAND("Gpx.FillAMapOverBorder %d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, s, d);
dst = sf_get(ds);
gr_fill_alpha_overborder(dst, dx, dy, dw, dh, s, d);
@@ -785,7 +785,7 @@ static void FillAMapUnderBorder() { /* not used ? */
int p6 = getCaliValue();
int p7 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.FillAMapUnderBorder %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7);
DEBUG_COMMAND_YET("Gpx.FillAMapUnderBorder %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7);
}
static void SaturDP_DPxSA() { /* not used ? */
@@ -798,7 +798,7 @@ static void SaturDP_DPxSA() { /* not used ? */
int p7 = getCaliValue();
int p8 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.SaturDP_DPxSA %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
DEBUG_COMMAND_YET("Gpx.SaturDP_DPxSA %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
}
static void ScreenDA_DAxSA() { /* not used ? */
@@ -811,7 +811,7 @@ static void ScreenDA_DAxSA() { /* not used ? */
int p7 = getCaliValue();
int p8 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.ScreenDA_DAxSA %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
DEBUG_COMMAND_YET("Gpx.ScreenDA_DAxSA %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
}
static void AddDA_DAxSA() { /* not used ? */
@@ -824,7 +824,7 @@ static void AddDA_DAxSA() { /* not used ? */
int p7 = getCaliValue();
int p8 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.AddDA_DAxSA %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
DEBUG_COMMAND_YET("Gpx.AddDA_DAxSA %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
}
static void SpriteCopyAMap() {
@@ -852,7 +852,7 @@ static void SpriteCopyAMap() {
int cl = getCaliValue();
surface_t *src, *dst;
DEBUG_COMMAND("Gpx.SpriteCopyAMap %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", da, dx, dy, sa, sx, sy, sw, sh, cl);
DEBUG_COMMAND("Gpx.SpriteCopyAMap %d,%d,%d,%d,%d,%d,%d,%d,%d:", da, dx, dy, sa, sx, sy, sw, sh, cl);
src = sf_get(sa);
dst = sf_get(da);
@@ -879,7 +879,7 @@ static void BrightDestOnly() {
int r = getCaliValue();
surface_t *dst;
DEBUG_COMMAND("Gpx.BrightDestOnly %d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, r);
DEBUG_COMMAND("Gpx.BrightDestOnly %d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, r);
dst = sf_get(ds);
@@ -900,7 +900,7 @@ static void CopyTextureWrap() { /* not used ? */
int p11 = getCaliValue();
int p12 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.CopyTextureWrap %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
DEBUG_COMMAND_YET("Gpx.CopyTextureWrap %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
}
static void CopyTextureWrapAlpha() { /* not used ? */
@@ -918,7 +918,7 @@ static void CopyTextureWrapAlpha() { /* not used ? */
int p12 = getCaliValue();
int p13 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.CopyTextureWrapAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);
DEBUG_COMMAND_YET("Gpx.CopyTextureWrapAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);
}
static void CopyStretch() {
@@ -948,7 +948,7 @@ static void CopyStretch() {
int sh = getCaliValue();
surface_t *src, *dst;
DEBUG_COMMAND_YET("Gpx.CopyStretch %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, ss, sx, sy, sw, sh);
DEBUG_COMMAND_YET("Gpx.CopyStretch %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, ss, sx, sy, sw, sh);
src = sf_get(ss);
dst = sf_get(ds);
@@ -968,7 +968,7 @@ static void CopyStretchBlend() { /* not used ? */
int p10 = getCaliValue();
int p11 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.CopyStretchBlend %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
DEBUG_COMMAND_YET("Gpx.CopyStretchBlend %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
}
static void CopyStretchBlendAMap() {
@@ -998,7 +998,7 @@ static void CopyStretchBlendAMap() {
int sh = getCaliValue();
surface_t *src, *dst;
DEBUG_COMMAND("Gpx.CopyStretchBlendAMap %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, ss, sx, sy, sw, sh);
DEBUG_COMMAND("Gpx.CopyStretchBlendAMap %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, ss, sx, sy, sw, sh);
src = sf_get(ss);
dst = sf_get(ds);
@@ -1015,7 +1015,7 @@ static void StretchBlendScreen2x2() { /* not used ? */
int p7 = getCaliValue();
int p8 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.StretchBlendScreen2x2 %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
DEBUG_COMMAND_YET("Gpx.StretchBlendScreen2x2 %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
}
@@ -1049,7 +1049,7 @@ static void StretchBlendScreen2x2WDS() {
int sh = getCaliValue();
surface_t *src1, *src2, *dst;
DEBUG_COMMAND("Gpx.StretchBlendScreen2x2WDS %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh);
DEBUG_COMMAND("Gpx.StretchBlendScreen2x2WDS %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh);
src1 = sf_get(ss1);
src2 = sf_get(ss2);
@@ -1086,7 +1086,7 @@ static void BlendScreenWDS() {
int sh = getCaliValue();
surface_t *src1, *src2, *dst;
DEBUG_COMMAND("Gpx.BlendScreenWDS %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh);
DEBUG_COMMAND("Gpx.BlendScreenWDS %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh);
src1 = sf_get(ss1);
src2 = sf_get(ss2);
@@ -1149,10 +1149,10 @@ static void EffectCopy() {
case 11:
case 12:
case 13:
DEBUG_COMMAND("Gpx.EffectCopy %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%p:\n", no, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh, time, var);
DEBUG_COMMAND("Gpx.EffectCopy %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%p:", no, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh, time, var);
break;
default:
DEBUG_COMMAND_YET("Gpx.EffectCopy %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%p:\n", no, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh, time, var);
DEBUG_COMMAND_YET("Gpx.EffectCopy %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%p:", no, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh, time, var);
}
dst = sf_get(ss1);
src = sf_get(ss2);
@@ -1163,7 +1163,7 @@ static void EffectCopy() {
static void SetClickCancelFlag() { /* not used ? */
int p1 = getCaliValue();
DEBUG_COMMAND_YET("Gpx.SetClikCancelFlag %d:\n", p1);
DEBUG_COMMAND_YET("Gpx.SetClikCancelFlag %d:", p1);
}
static const ModuleFunc functions[] = {
+1 -1
View File
@@ -26,7 +26,7 @@ void gpx_effect(int no,
enum sdl_effect_type type = from_sact_effect(no);
if (type == EFFECT_INVALID) {
WARNING("Unimplemented effect %d\n", no);
WARNING("Unimplemented effect %d", no);
type = EFFECT_CROSSFADE;
}
SDL_Rect rect = { wx, wy, width, height };
+4 -4
View File
@@ -42,7 +42,7 @@ static void RandMTInit() {
*/
int p1 = getCaliValue(); /* ITimer */
DEBUG_COMMAND("Math.RandMTInit %d:\n", p1);
DEBUG_COMMAND("Math.RandMTInit %d:", p1);
}
static void RandMTGet() {
@@ -61,7 +61,7 @@ static void RandMTGet() {
*var = (int)(genrand() * num) + 1;
}
DEBUG_COMMAND("Math.RandMTGet %d,%p:\n", num, var);
DEBUG_COMMAND("Math.RandMTGet %d,%p:", num, var);
}
static void RandMTMakeNumTable() {
@@ -74,7 +74,7 @@ static void RandMTMakeNumTable() {
numtblmax = p1;
DEBUG_COMMAND("Math.RandMTMakeNumTable %d:\n", p1);
DEBUG_COMMAND("Math.RandMTMakeNumTable %d:", p1);
}
static void RandMTGetNumTable() {
@@ -87,7 +87,7 @@ static void RandMTGetNumTable() {
*var = (int)(genrand() * numtblmax) + 1;
DEBUG_COMMAND("Math.RandMTGetNumTable %d:\n", *var);
DEBUG_COMMAND("Math.RandMTGetNumTable %d:", *var);
}
static const ModuleFunc functions[] = {
+8 -8
View File
@@ -26,7 +26,7 @@ static void Init() {
valid = true;
*p1 = 0;
DEBUG_COMMAND("MsgSkip.Init %p,%d,%d,%d:\n", p1, p2, p3, p4);
DEBUG_COMMAND("MsgSkip.Init %p,%d,%d,%d:", p1, p2, p3, p4);
}
static void Start() {
@@ -39,7 +39,7 @@ static void Start() {
free(path);
free(fname_utf8);
DEBUG_COMMAND("MsgSkip.Start %p,%d:\n", p1, p2);
DEBUG_COMMAND("MsgSkip.Start %p,%d:", p1, p2);
}
static void SetValid() {
@@ -48,7 +48,7 @@ static void SetValid() {
valid = p1;
msgskip_pause(!valid);
DEBUG_COMMAND("MsgSkip.SetValid %d:\n", p1);
DEBUG_COMMAND("MsgSkip.SetValid %d:", p1);
}
static void GetValid() {
@@ -56,7 +56,7 @@ static void GetValid() {
*p1 = valid;
DEBUG_COMMAND("MsgSkip.GetValid %p:\n", p1);
DEBUG_COMMAND("MsgSkip.GetValid %p:", p1);
}
static void SetAction() {
@@ -64,7 +64,7 @@ static void SetAction() {
action = p1;
DEBUG_COMMAND("MsgSkip.SetAcion %d:\n", p1);
DEBUG_COMMAND("MsgSkip.SetAcion %d:", p1);
}
static void GetAction() {
@@ -72,19 +72,19 @@ static void GetAction() {
*p1 = action;
DEBUG_COMMAND("MsgSkip.GetAcion %p:\n", p1);
DEBUG_COMMAND("MsgSkip.GetAcion %p:", p1);
}
static void PushStr() {
int p1 = getCaliValue();
DEBUG_COMMAND_YET("MsgSkip.PushStr %d:\n", p1);
DEBUG_COMMAND_YET("MsgSkip.PushStr %d:", p1);
}
static void PopStr() {
int p1 = getCaliValue();
DEBUG_COMMAND_YET("MsgSkip.PopStr %d:\n", p1);
DEBUG_COMMAND_YET("MsgSkip.PopStr %d:", p1);
}
static const ModuleFunc functions[] = {
+68 -68
View File
@@ -36,7 +36,7 @@ static void Init(void) { /* 0 */
*var = 1;
DEBUG_COMMAND_YET("NIGHTDLL.Init %p:\n", var);
DEBUG_COMMAND_YET("NIGHTDLL.Init %p:", var);
}
static void NIGHTDLL_reset(void) {
@@ -62,7 +62,7 @@ static void InitGame() { /* 1 */
ntmsg_init();
nt_sstr_init();
DEBUG_COMMAND_YET("NIGHTDLL.InitGame:\n");
DEBUG_COMMAND_YET("NIGHTDLL.InitGame:");
}
// メッセージの枠の表示
@@ -71,7 +71,7 @@ static void SetMsgFrame() { /* 2 */
ntmsg_set_frame(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgFram %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgFram %d:", p1);
}
// メッセージの表示位置の設定
@@ -80,21 +80,21 @@ static void SetMsgPlaceMethod(void) { /* 3 */
// 2=メッセージ枠+顔つき
ntmsg_set_place(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgPlaceMethod %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgPlaceMethod %d:", p1);
}
// 未実装?
static void SetMsgDrawEffect(void) { /* 4 */
int p1 = getCaliValue(); // 0, 1, 2, 3 (実際にはどれも機能しない?)
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgDrawEffect %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgDrawEffect %d:", p1);
}
// 未実装?
static void SetMsgClearEffect(void) { /* 5 */
int p1 = getCaliValue(); // 0, 1, 2, 4 (実際にはどれも機能しない?)
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgClearEffect %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgClearEffect %d:", p1);
}
// 壁紙CGの設定
@@ -103,7 +103,7 @@ static void SetWallPaper(void) { /* 6 */
nt_gr_set_wallpaper(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetWallPaper %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetWallPaper %d:", p1);
}
// 背景CGの設定
@@ -112,7 +112,7 @@ static void SetScenery(void) { /* 7 */
nt_gr_set_scenery(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetScenery %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetScenery %d:", p1);
}
// 顔CGの設定
@@ -121,7 +121,7 @@ static void SetFace(void) { /* 8 */
nt_gr_set_face(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetFace %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetFace %d:", p1);
}
// 立ち絵左の設定
@@ -130,7 +130,7 @@ static void SetSpriteL(void) { /* 9 */
nt_gr_set_spL(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteL %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteL %d:", p1);
}
// 立ち絵中央の設定
@@ -139,7 +139,7 @@ static void SetSpriteM(void) { /* 10 */
nt_gr_set_spM(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteM %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteM %d:", p1);
}
// 立ち絵右の設定
@@ -148,7 +148,7 @@ static void SetSpriteR(void) { /* 11 */
nt_gr_set_spR(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteR %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteR %d:", p1);
}
// 立ち絵左の設定(季節違い?)
@@ -157,7 +157,7 @@ static void SetSpriteSeasonL(void) { /* 12 */
nt_gr_set_spsL(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteSeasonL %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteSeasonL %d:", p1);
}
// 立ち絵中央の設定(季節違い?)
@@ -166,7 +166,7 @@ static void SetSpriteSeasonM(void) { /* 13 */
nt_gr_set_spM(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteSeasonM %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteSeasonM %d:", p1);
}
// 立ち絵右の設定(季節違い?)
@@ -175,14 +175,14 @@ static void SetSpriteSeasonR(void) { /* 14 */
nt_gr_set_spsR(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteSeasonR %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteSeasonR %d:", p1);
}
// 改行
static void StartNewLine(void) { /* 15 */
ntmsg_newline();
DEBUG_COMMAND_YET("NIGHTDLL.StartNewLine:\n");
DEBUG_COMMAND_YET("NIGHTDLL.StartNewLine:");
}
// メッセージフォントサイズの設定
@@ -191,7 +191,7 @@ static void SetFontSize(void) { /* 16 */
night.fontsize = p1;
DEBUG_COMMAND_YET("NIGHTDLL.SetFontSize %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetFontSize %d:", p1);
}
// フォントの種類の設定
@@ -200,7 +200,7 @@ static void SetFont(void) { /* 17 */
night.fonttype = p1;
DEBUG_COMMAND_YET("NIGHTDLL.SetFont %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetFont %d:", p1);
}
// 選択肢モード ON
@@ -209,7 +209,7 @@ static void SetSelMode(void) { /* 18 */
night.selmode = p1;
DEBUG_COMMAND_YET("NIGHTDLL.SetSelMode %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetSelMode %d:", p1);
}
// キー入力待ち後、改ページ
@@ -218,7 +218,7 @@ static void AnalyzeMessage(void) { /* 19 */
*var = ntmsg_ana();
DEBUG_COMMAND_YET("NIGHTDLL.AnalyzeMessage %p:\n", var);
DEBUG_COMMAND_YET("NIGHTDLL.AnalyzeMessage %p:", var);
}
// ~DRAWの効果時間
@@ -227,7 +227,7 @@ static void SetDrawTime(void) { /* 20 */
nt_gr_set_drawtime(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetDrawTime %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetDrawTime %d:", p1);
}
// 効果つき画面更新
@@ -236,7 +236,7 @@ static void Draw(void) { /* 21 */
nt_gr_draw(p1);
DEBUG_COMMAND_YET("NIGHTDLL.Draw %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.Draw %d:", p1);
}
// 音声データを再生
@@ -245,21 +245,21 @@ static void SetVoice(void) { /* 22 */
nt_voice_set(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetVoice %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetVoice %d:", p1);
}
// 未使用
static void WaitKey(void) { /* 23 */
int p1 = getCaliValue(); //
DEBUG_COMMAND_YET("NIGHTDLL.WaitKey %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.WaitKey %d:", p1);
}
static void AddFeeling(void) { /* 24 */
int p1 = getCaliValue(); // person(1:新開,2:星川,3:百瀬,4:いずみ,5:鏡花,6:真言美,7:マコト
int p2 = getCaliValue(); // val
DEBUG_COMMAND_YET("NIGHTDLL.AddFeeling %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.AddFeeling %d:", p1);
}
@@ -267,7 +267,7 @@ static void SubFeeling(void) { /* 25 */
int p1 = getCaliValue(); // person
int p2 = getCaliValue(); // val
DEBUG_COMMAND_YET("NIGHTDLL.SubFeeling %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SubFeeling %d:", p1);
}
static void CallEvent(void) { /* 26 */
@@ -275,7 +275,7 @@ static void CallEvent(void) { /* 26 */
nt_sco_callevent(p1);
DEBUG_COMMAND_YET("NIGHTDLL.CallEvent %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.CallEvent %d:", p1);
}
static void ScreenCG(void) { /* 27 */
@@ -294,7 +294,7 @@ static void ScreenCG(void) { /* 27 */
nt_gr_screencg(no, x, y);
DEBUG_COMMAND_YET("NIGHTDLL.ScreenCG %d,%d,%d:\n", x, y, no);
DEBUG_COMMAND_YET("NIGHTDLL.ScreenCG %d,%d,%d:", x, y, no);
}
static void RunGameMain(void) { /* 28 */
@@ -310,7 +310,7 @@ static void RunGameMain(void) { /* 28 */
*p1 = nt_sco_main(p5);
DEBUG_COMMAND_YET("NIGHTDLL.RunGameMain %p,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5);
DEBUG_COMMAND_YET("NIGHTDLL.RunGameMain %p,%d,%d,%d,%d:", p1, p2, p3, p4, p5);
}
static void CheckNewGame(void) { /* 29 */
@@ -318,21 +318,21 @@ static void CheckNewGame(void) { /* 29 */
*p1 = 0;
DEBUG_COMMAND_YET("NIGHTDLL.CheckNewGame %p:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.CheckNewGame %p:", p1);
}
static void SaveStartData(void) { /* 30 */
DEBUG_COMMAND_YET("NIGHTDLL.SaveStartData:\n");
DEBUG_COMMAND_YET("NIGHTDLL.SaveStartData:");
}
static void PrintExitSystem(void) { /* 31 */
DEBUG_COMMAND_YET("NIGHTDLL.PrintExitSystem:\n");
DEBUG_COMMAND_YET("NIGHTDLL.PrintExitSystem:");
}
static void SetCalendar(void) { /* 32 */
int p1 = getCaliValue(); // 0, 1, 2
DEBUG_COMMAND_YET("NIGHTDLL.SetCalendar %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetCalendar %d:", p1);
}
static void SetDate(void) { /* 33 */
@@ -344,7 +344,7 @@ static void SetDate(void) { /* 33 */
night.Day = p2;
night.DayOfWeek = p3;
DEBUG_COMMAND_YET("NIGHTDLL.SetDate %d,%d,%d:\n", p1, p2, p3);
DEBUG_COMMAND_YET("NIGHTDLL.SetDate %d,%d,%d:", p1, p2, p3);
}
static void GetDate(void) { /* 34 */
@@ -356,11 +356,11 @@ static void GetDate(void) { /* 34 */
*p2 = night.Day;
*p3 = night.DayOfWeek;
DEBUG_COMMAND_YET("NIGHTDLL.GetDate %p,%p,%p:\n", p1, p2, p3);
DEBUG_COMMAND_YET("NIGHTDLL.GetDate %p,%p,%p:", p1, p2, p3);
}
static void SelectGameLevel(void) { /* 35 */
DEBUG_COMMAND_YET("NIGHTDLL.SelectGameLevel:\n");
DEBUG_COMMAND_YET("NIGHTDLL.SelectGameLevel:");
}
static void RunEventDungeon(void) { /* 36 */
@@ -369,13 +369,13 @@ static void RunEventDungeon(void) { /* 36 */
*p1 = 1;
DEBUG_COMMAND_YET("NIGHTDLL.RunEventDungeon %p,%d:\n", p1, p2);
DEBUG_COMMAND_YET("NIGHTDLL.RunEventDungeon %p,%d:", p1, p2);
}
static void RunEventBattle(void) { /* 37 */
int p1 = getCaliValue(); // 実際には機能しない?
DEBUG_COMMAND_YET("NIGHTDLL.RunEventBattle %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.RunEventBattle %d:", p1);
}
// CD再生開始
@@ -384,7 +384,7 @@ static void CDPlay(void) { /* 38 */
nt_cd_play(p1);
DEBUG_COMMAND_YET("NIGHTDLL.CDPlay %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.CDPlay %d:", p1);
}
// CD再生停止
@@ -393,7 +393,7 @@ static void CDStop(void) { /* 39 */
nt_cd_stop(p1);
DEBUG_COMMAND_YET("NIGHTDLL.CDStop %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.CDStop %d:", p1);
}
// CDのmute
@@ -402,7 +402,7 @@ static void CDMute(void) { /* 40 */
nt_cd_mute(p1 == 0 ? FALSE : TRUE);
DEBUG_COMMAND_YET("NIGHTDLL.CDMute %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.CDMute %d:", p1);
}
// ch に効果音番号をセット
@@ -412,7 +412,7 @@ static void SoundEffectSetWave(void) { /* 41 */
nt_snd_setwave(p1, p2);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectSetWave %d,%d:\n", p1, p2);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectSetWave %d,%d:", p1, p2);
}
// ch にくり返し数をセット
@@ -422,7 +422,7 @@ static void SoundEffectSetLoop(void) { /* 42 */
nt_snd_setloop(p1, p2);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectSetLoop %d,%d:\n", p1, p2);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectSetLoop %d,%d:", p1, p2);
}
// ch に音量をセット
@@ -432,7 +432,7 @@ static void SoundEffectSetVolume(void) { /* 43 */
nt_snd_setvol(p1, p2);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectSetVolue %d,%d:\n", p1, p2);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectSetVolue %d,%d:", p1, p2);
}
// 効果音の再生を終るまで待つか待たないか?
@@ -442,7 +442,7 @@ static void SoundEffectSetSyncFlag(void) { /* 44 */
nt_snd_waitend(p1, p2 == 0 ? FALSE : TRUE);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectSetSyncFlag %d,%d:\n", p1, p2);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectSetSyncFlag %d,%d:", p1, p2);
}
// ch の効果音を再生
@@ -451,7 +451,7 @@ static void SoundEffectPlay(void) { /* 45 */
nt_snd_play(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectPlay %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectPlay %d:", p1);
}
// ch の効果音を停止
@@ -461,7 +461,7 @@ static void SoundEffectStop(void) { /* 46 */
nt_snd_stop(p1, p2);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectStop %d,%d:\n", p1,p2);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectStop %d,%d:", p1,p2);
}
// 全てのチャンネルの再生を停止
@@ -470,86 +470,86 @@ static void SoundEffectStopAll(void) { /* 47 */
nt_snd_stopall(p1);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectStopAll %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectStopAll %d:", p1);
}
static void RunSoundMode(void) { /* 48 */
DEBUG_COMMAND_YET("NIGHTDLL.RunSoundMode:\n");
DEBUG_COMMAND_YET("NIGHTDLL.RunSoundMode:");
}
static void RunMapEditor(void) { /* 49 */
int *p1 = getCaliVariable();
DEBUG_COMMAND_YET("NIGHTDLL.RunMapEditor %p:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.RunMapEditor %p:", p1);
}
static void VisualListClear(void) { /* 50 */
DEBUG_COMMAND_YET("NIGHTDLL.VisualListClear:\n");
DEBUG_COMMAND_YET("NIGHTDLL.VisualListClear:");
}
static void VisualListAdd(void) { /* 51 */
int p1 = getCaliValue();
DEBUG_COMMAND_YET("NIGHTDLL.VisualListAdd %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.VisualListAdd %d:", p1);
}
static void GetLocalCountCG(void) { /* 52 */
int *p1 = getCaliVariable();
int p2 = getCaliValue();
DEBUG_COMMAND_YET("NIGHTDLL.GetLocalCountCG %p,%d:\n", p1, p2);
DEBUG_COMMAND_YET("NIGHTDLL.GetLocalCountCG %p,%d:", p1, p2);
}
static void PlayMemory(void) { /* 53 */
int *p1 = getCaliVariable(); // 回想ページ
int *p2 = getCaliVariable(); // 回想RESULT
DEBUG_COMMAND_YET("NIGHTDLL.PlayMemory %p,%p:\n", p1, p2);
DEBUG_COMMAND_YET("NIGHTDLL.PlayMemory %p,%p:", p1, p2);
}
static void GetEventFlagTotal(void) { /* 54 */
int *p1 = getCaliVariable();
int p2 = getCaliValue();
DEBUG_COMMAND_YET("NIGHTDLL.GetEventFlagTotal %p,%d:\n", p1, p2);
DEBUG_COMMAND_YET("NIGHTDLL.GetEventFlagTotal %p,%d:", p1, p2);
}
static void SetPlayerName(void) { /* 55 */
int p1 = getCaliValue();
DEBUG_COMMAND_YET("NIGHTDLL.SetPlayerName %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SetPlayerName %d:", p1);
}
static void GetPlayerName(void) { /* 56 */
int p1 = getCaliValue();
DEBUG_COMMAND_YET("NIGHTDLL.GetPlayerName %d:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.GetPlayerName %d:", p1);
}
static void SaveGame(void) { /* 57 */
int *p1 = getCaliVariable();
DEBUG_COMMAND_YET("NIGHTDLL.SaveGame %p:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.SaveGame %p:", p1);
}
static void LoadGame(void) { /* 58 */
int *p1 = getCaliVariable();
DEBUG_COMMAND_YET("NIGHTDLL.LoadGame %p:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.LoadGame %p:", p1);
}
static void ExistSaveData(void) { /* 59 */
int *p1 = getCaliVariable();
DEBUG_COMMAND_YET("NIGHTDLL.ExistSaveData %p:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.ExistSaveData %p:", p1);
}
static void ExistStartData(void) { /* 60 */
int *p1 = getCaliVariable();
DEBUG_COMMAND_YET("NIGHTDLL.ExistStartData %p:\n", p1);
DEBUG_COMMAND_YET("NIGHTDLL.ExistStartData %p:", p1);
}
static void SetAreaData(void) { /* 61 */
@@ -557,27 +557,27 @@ static void SetAreaData(void) { /* 61 */
int p2 = getCaliValue();
int p3 = getCaliValue();
DEBUG_COMMAND_YET("NIGHTDLL.SetAreaData %d,%d,%d:\n", p1, p2, p3);
DEBUG_COMMAND_YET("NIGHTDLL.SetAreaData %d,%d,%d:", p1, p2, p3);
}
static void RunBattleTest(void) { /* 62 */
DEBUG_COMMAND_YET("NIGHTDLL.RunBattleTest:\n");
DEBUG_COMMAND_YET("NIGHTDLL.RunBattleTest:");
}
static void RunTrainingTest(void) { /* 63 */
DEBUG_COMMAND_YET("NIGHTDLL.RunTrainingTest:\n");
DEBUG_COMMAND_YET("NIGHTDLL.RunTrainingTest:");
}
static void TestEventCall(void) { /* 64 */
DEBUG_COMMAND_YET("NIGHTDLL.TestEventCall:\n");
DEBUG_COMMAND_YET("NIGHTDLL.TestEventCall:");
}
static void Test(void) { /* 65 */
DEBUG_COMMAND_YET("NIGHTDLL.Test:\n");
DEBUG_COMMAND_YET("NIGHTDLL.Test:");
}
static void DebugScenario(void) { /* 66 */
DEBUG_COMMAND_YET("NIGHTDLL.DebugScenario:\n");
DEBUG_COMMAND_YET("NIGHTDLL.DebugScenario:");
}
static void GetDLLTime(void) { /* 67 */
@@ -589,7 +589,7 @@ static void GetDLLTime(void) { /* 67 */
int *p6 = getCaliVariable();
int *p7 = getCaliVariable();
DEBUG_COMMAND_YET("NIGHTDLL.GetDLLTime %p,%p,%p,%p,%p,%p,%p:\n", p1, p2, p3, p4, p5, p6, p7);
DEBUG_COMMAND_YET("NIGHTDLL.GetDLLTime %p,%p,%p,%p,%p,%p,%p:", p1, p2, p3, p4, p5, p6, p7);
}
static const ModuleFunc functions[] = {
+5 -6
View File
@@ -7,7 +7,6 @@
#include "menu.h"
#include "input.h"
#include "nact.h"
#include "key.h"
#include "night.h"
#include "sprite.h"
@@ -33,7 +32,7 @@ static void cb_waitkey_simple(agsevent_t *e) {
switch (e->type) {
case AGSEVENT_BUTTON_RELEASE:
case AGSEVENT_KEY_RELEASE:
night.waitkey = e->d3;
night.waitkey = e->code;
break;
}
}
@@ -59,15 +58,15 @@ void ntev_callback(agsevent_t *e) {
return;
}
if (e->type == AGSEVENT_KEY_PRESS && e->d3 == KEY_CTRL) {
if (e->type == AGSEVENT_KEY_PRESS && e->code == KEY_CTRL) {
night.waitskiplv = 2;
night.waitkey = e->d3;
night.waitkey = e->code;
return;
}
if (e->type == AGSEVENT_KEY_RELEASE && e->d3 == KEY_CTRL) {
if (e->type == AGSEVENT_KEY_RELEASE && e->code == KEY_CTRL) {
night.waitskiplv = 0;
night.waitkey = e->d3;
night.waitkey = e->code;
return;
}
+10 -16
View File
@@ -55,7 +55,7 @@ extern int ntsel_dosel(void);
static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wFont, int wSpeed, int wLineSpace);
static void set_align(char *msg, sprite_t *sp, int wSize);
static BYTE *get_char(BYTE *msg, char *mbuf, int bufmax);
static uint8_t *get_char(uint8_t *msg, char *mbuf, int bufmax);
static void cb_keyrelease(agsevent_t *e);
static void cb_mousemove(agsevent_t *e);
static void setup_hakanim();
@@ -177,20 +177,20 @@ void ntmsg_set_place(int type) {
}
void ntmsg_newline() {
BYTE buf[2] = {'\n', '\0'};
uint8_t buf[2] = {'\n', '\0'};
ntmsg_add(buf);
}
void ntmsg_add(const char *msg) {
int len;
SACT_DEBUG("len = %d\n", strlen(msg));
SACT_DEBUG("len = %d", strlen(msg));
if (msg[0] == '\0') return;
len = MSGBUFMAX - (int)strlen(night.msgbuf);
if (len < 0) {
WARNING("buf shortage (%d)\n", len);
WARNING("buf shortage (%d)", len);
return;
}
strncat(night.msgbuf, msg, len);
@@ -371,14 +371,14 @@ static void set_align(char *msg, sprite_t *sp, int wSize) {
}
static BYTE *get_char(BYTE *msg, char *mbuf, int bufmax) {
static uint8_t *get_char(uint8_t *msg, char *mbuf, int bufmax) {
if (msg[0] == '\n') {
mbuf[0] = '\n';
mbuf[1] = '\0';
return msg +1;
}
BYTE *p = advance_char(msg, nact->encoding);
uint8_t *p = advance_char(msg, nact->encoding);
while (msg < p)
*mbuf++ = *msg++;
*mbuf = '\0';
@@ -392,13 +392,11 @@ static void is_in_icon() {
static void cb_keyrelease(agsevent_t *e) {
int x = e->d1, y = e->d2;
switch (e->d3) {
switch (e->code) {
case AGSEVENT_BUTTON_LEFT:
#if 0
if (is_in_icon()) {
do_icon(x, y);
do_icon(e->mousex, e->mousey);
break;
}
#endif
@@ -408,19 +406,15 @@ static void cb_keyrelease(agsevent_t *e) {
// unhide();
break;
}
night.waitkey = e->d3;
night.waitkey = e->code;
break;
}
}
static void cb_mousemove(agsevent_t *e) {
int x = e->d1, y = e->d2;
// 音声mute/メッセージスキップ/メッセージ枠消去の領域に
// マウスが移動したら、その部分のアイコンを変化させる
}
// メッセージ表示時に、キー入力を促すアニメーションの設定
@@ -475,7 +469,7 @@ int ntmsg_update(sprite_t *sp, MyRectangle *r) {
gre_BlendUseAMap(sf0, dx, dy, sf0, dx, dy, sp->u.msg.canvas, sx, sy, w, h, sp->u.msg.canvas, sx, sy, sp->blendrate);
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n",
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d",
sp->no, sx, sy, w, h, dx, dy);
return OK;
+3 -3
View File
@@ -30,7 +30,7 @@ static struct _scoadr scene2adr(int no) {
struct _scoadr adr = {0, 0};
snprintf(label, 7, "E%05d", no);
SACT_DEBUG("seaching %6s\n", label);
SACT_DEBUG("seaching %6s", label);
for (i = 0; i < nact->ain.fncnum; i++) {
if (0 == strncmp(nact->ain.fnc[i].name, label, 6)) {
adr.page = nact->ain.fnc[i].page;
@@ -39,7 +39,7 @@ static struct _scoadr scene2adr(int no) {
}
}
WARNING("no scene %d\n", no);
WARNING("no scene %d", no);
return adr;
}
@@ -53,7 +53,7 @@ static void ntmain(struct _scoadr inadr) {
while (!nact->is_quit) {
for (int cnt = 0; !nact->is_quit && !nact->wait_vsync && cnt < 10000; cnt++) {
//SACT_DEBUG("%d:%x\n", sl_getPage(), sl_getIndex());
//SACT_DEBUG("%d:%x", sl_getPage(), sl_getIndex());
if (!nact->popupmenu_opened) {
exec_command();
if (sl_getPage() == inadr.page &&
+1 -1
View File
@@ -23,7 +23,7 @@ void nt_voice_set(int no) {
}
void nt_cd_play(int no) {
mus_cdrom_start(no +1, 0);
muscd_start(no + 1, 0);
}
void nt_cd_stop(int msec) {
+3 -3
View File
@@ -44,7 +44,7 @@ static cginfo_t *cgs[CGMAX];
#define spcg_assert_no(no) \
if ((no) > (CGMAX -1)) { \
WARNING("no is too large (should be %d < %d)\n", (no), CGMAX); \
WARNING("no is too large (should be %d < %d)", (no), CGMAX); \
return NG; \
} \
@@ -71,7 +71,7 @@ static cginfo_t *nt_scg_new(enum cgtype type, int no, surface_t *sf) {
*/
static cginfo_t *nt_scg_get(int no) {
if (no >= (CGMAX -1)) {
WARNING("no is too large (should be %d < %d)\n", (no), CGMAX);
WARNING("no is too large (should be %d < %d)", (no), CGMAX);
return NULL;
}
@@ -80,7 +80,7 @@ static cginfo_t *nt_scg_get(int no) {
surface_t *sf = sf_loadcg_no(no - 1);
if (!sf) {
WARNING("load fail (%d)\n", no -1);
WARNING("load fail (%d)", no -1);
return NULL;
}
return nt_scg_new(CG_LINKED, no, sf);
+11 -11
View File
@@ -5,7 +5,7 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
int sw, sh;
int *row, *col;
int x, y;
BYTE *sdata, *ddata;
uint8_t *sdata, *ddata;
dst->width = dw;
dst->height = dh;
@@ -57,14 +57,14 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
#define SCALEDCOPYAREA(type) { \
int x, y; \
type *sl, *dl; \
BYTE *_sl, *_dl; \
uint8_t *_sl, *_dl; \
for (y = 0; y < dh; y++) { \
sl = (type *)(sdata + *(y + col) * src->bytes_per_line);\
dl = (type *)(ddata + y * dst->bytes_per_line);\
for (x = 0; x < dw; x++) { \
*(dl + x) = *(sl + *(row + x)); \
} \
_dl = (BYTE *)dl; \
_dl = (uint8_t *)dl; \
while(*(col + y) == *(col + y + 1)) { \
_sl = _dl; \
_dl += dst->bytes_per_line; \
@@ -75,29 +75,29 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
switch(dst->depth) {
case 8:
SCALEDCOPYAREA(BYTE); break;
SCALEDCOPYAREA(uint8_t); break;
case 16:
SCALEDCOPYAREA(WORD); break;
SCALEDCOPYAREA(uint16_t); break;
case 24:
case 32:
SCALEDCOPYAREA(DWORD); break;
SCALEDCOPYAREA(uint32_t); break;
default:
break;
}
if (src->alpha) {
int x, y;
BYTE *sl, *dl;
BYTE *_sl, *_dl;
uint8_t *sl, *dl;
uint8_t *_sl, *_dl;
sdata = GETOFFSET_ALPHA(src, 0, 0);
ddata = GETOFFSET_ALPHA(dst, 0, 0);
for (y = 0; y < dh; y++) {
sl = (BYTE *)(sdata + *(y + col) * src->width);
dl = (BYTE *)(ddata + y * dst->width);
sl = (uint8_t *)(sdata + *(y + col) * src->width);
dl = (uint8_t *)(ddata + y * dst->width);
for (x = 0; x < dw; x++) {
*(dl + x) = *(sl + *(row + x));
}
_dl = (BYTE *)dl;
_dl = (uint8_t *)dl;
while(*(col + y) == *(col + y + 1)) {
_sl = _dl;
_dl += dst->width;
+2 -2
View File
@@ -96,7 +96,7 @@ int nt_sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r) {
}
}
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n",
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d",
sp->no, sx, sy, w, h, dx, dy);
return OK;
@@ -136,7 +136,7 @@ int nt_sp_draw_scg(sprite_t *sp, MyRectangle *r) {
sf0, dx, dy,
cg->sf, sx, sy, w, h);
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n",
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d",
sp->no, sx, sy, w, h, dx, dy);
return OK;
+1 -1
View File
@@ -47,7 +47,7 @@ int nt_sp_eupdate(int no, int time, int cancel) {
enum sdl_effect_type type = from_sact_effect(no - 100);
if (type == EFFECT_INVALID) {
WARNING("Unimplemented effect %d\n", no);
WARNING("Unimplemented effect %d", no);
type = EFFECT_CROSSFADE;
}
SDL_Rect rect = { 0, 0, sf0->width, sf0->height };
+4 -4
View File
@@ -68,7 +68,7 @@ static MyRectangle get_updatearea() {
// surface0との領域の積をとる
SDL_IntersectRect(&rsf0, &clip, &result);
SACT_DEBUG("clipped area x=%d y=%d w=%d h=%d\n",
SACT_DEBUG("clipped area x=%d y=%d w=%d h=%d",
result.x, result.y, result.w, result.h);
return result;
@@ -150,7 +150,7 @@ int nt_sp_updateme(sprite_t *sp) {
updatearea = slist_append(updatearea, r);
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d\n",
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d",
r->x, r->y, sp->no, r->w, r->h);
return OK;
@@ -178,7 +178,7 @@ int nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
updatearea = slist_append(updatearea, r);
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d\n",
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d",
r->x, r->y, sp->no, r->w, r->h);
return OK;
@@ -223,7 +223,7 @@ int nt_sp_draw_wall(sprite_t *sp, MyRectangle *area) {
h = area->h;
gr_fill(sf0, sx, sy, w, h, 0, 0, 0);
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, \n",
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d",
sp->no, sx, sy, w, h);
return OK;
+5 -5
View File
@@ -51,7 +51,7 @@ static void ndd_run(int demonum) {
int mus = ndemo_mus[demonum];
if (mus)
mus_bgm_play(mus, 0, 100);
musbgm_play(mus, 0, 100);
uint32_t start = sdl_getTicks();
while (!nact->is_quit) {
@@ -65,7 +65,7 @@ static void ndd_run(int demonum) {
ags_updateFull();
cgdata_free(cg);
} else {
WARNING("Cannot decode CG %d in %s\n", i, alk_path);
WARNING("Cannot decode CG %d in %s", i, alk_path);
}
int wait_ms = (i + 1) * (1000 / FPS) - (sdl_getTicks() - start);
@@ -79,7 +79,7 @@ static void ndd_run(int demonum) {
}
if (mus)
mus_bgm_stop(ndemo_mus[demonum], 0);
musbgm_stop(ndemo_mus[demonum], 0);
alk_free(alk);
}
@@ -92,7 +92,7 @@ static void Init() {
*var = 1;
DEBUG_COMMAND("NightDemonDemo.Init %d,%d,%d,%p:\n", p1, p2, p3, var);
DEBUG_COMMAND("NightDemonDemo.Init %d,%d,%d,%p:", p1, p2, p3, var);
}
static void Run() {
@@ -101,7 +101,7 @@ static void Run() {
ndd_run(p1);
DEBUG_COMMAND("NightDemonDemo.Run %d,%d:\n", p1, p2);
DEBUG_COMMAND("NightDemonDemo.Run %d,%d:", p1, p2);
}
static const ModuleFunc functions[] = {
+3 -3
View File
@@ -40,7 +40,7 @@ static void Init() {
*/
int p1 = getCaliValue(); /* ITimer */
DEBUG_COMMAND_YET("RandMT.Init %p:\n", p1);
DEBUG_COMMAND_YET("RandMT.Init %p:", p1);
}
static void Get() {
@@ -59,7 +59,7 @@ static void Get() {
*var = (int)(genrand() * num) + 1;
}
DEBUG_COMMAND("RandMT.Get %d,%p:\n", num, var);
DEBUG_COMMAND("RandMT.Get %d,%p:", num, var);
}
static void GetNoOverlap() {
@@ -69,7 +69,7 @@ static void GetNoOverlap() {
*var = (int)(genrand() * n) + min;
DEBUG_COMMAND("RandMT.GetNoOverlap %d,%d,%p:\n", min, n, var);
DEBUG_COMMAND("RandMT.GetNoOverlap %d,%d,%p:", min, n, var);
}
static const ModuleFunc functions[] = {
+143 -138
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -99,8 +99,8 @@ static surface_t *smask_get(int no) {
// ベースになるマスクの alpha 値を拡大して取り出す
static surface_t *smask_mul(surface_t *sf, int val) {
surface_t *out = sf_create_alpha(sf->width, sf->height);
BYTE *src = sf->alpha;
BYTE *dst = out->alpha;
uint8_t *src = sf->alpha;
uint8_t *dst = out->alpha;
int pix = sf->width * sf->height;
while(pix--) {
-93
View File
@@ -1,93 +0,0 @@
/*
* sactbgm.c: SACT Music 関連
*
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
* 1998- <masaki-c@is.aist-nara.ac.jp>
*
* 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
*
*/
/* $Id: sactbgm.c,v 1.4 2003/08/30 21:29:16 chikama Exp $ */
#include "config.h"
#include <stdio.h>
#include "portab.h"
#include "system.h"
#include "ald_manager.h"
#include "music.h"
// 指定の番号の音楽が存在するかチェック
int smus_check(int no) {
dridata *dfile = ald_getdata(DRIFILE_BGM, no -1);
int st = 0;
if (dfile == NULL) {
st = 0;
} else {
st = 1;
ald_freedata(dfile);
}
return st;
}
// 指定の番号の音楽の長さを取得
int smus_getlength(int no) {
return mus_bgm_getlength(no);
}
// 指定の番号の音楽の再生位置を取得
int smus_getpos(int no) {
return mus_bgm_getpos(no);
}
// 指定の番号の音楽の再生開始
int smus_play(int no, int time, int vol) {
mus_bgm_play(no, time, vol);
return OK;
}
// 指定の番号の音楽の再生停止
int smus_stop(int no, int fadetime) {
mus_bgm_stop(no, fadetime);
return OK;
}
// 指定の番号の音楽のボリュームフェード
int smus_fade(int no, int time, int vol) {
mus_bgm_fade(no, time, vol);
return OK;
}
// 指定の番号の音楽が終了するのを待つ
int smus_wait(int no, int timeout) {
mus_bgm_wait(no, timeout);
return OK;
}
// 指定の番号の音楽が指定の位置まで再生されるのを待つ
int smus_waitpos(int no, int index) {
mus_bgm_waitpos(no, index);
return OK;
}
// 全ての音楽の再生を停止
int smus_stopall(int time) {
mus_bgm_stopall(time);
return OK;
}
+3 -3
View File
@@ -41,7 +41,7 @@
#define spcg_assert_no(no) \
if ((no) > (CGMAX -1)) { \
WARNING("no is too large (should be %d < %d)\n", (no), CGMAX); \
WARNING("no is too large (should be %d < %d)", (no), CGMAX); \
return NG; \
} \
@@ -68,7 +68,7 @@ static cginfo_t *scg_new(enum cgtype type, int no, surface_t *sf) {
*/
static cginfo_t *scg_get(int no) {
if (no >= (CGMAX -1)) {
WARNING("no is too large (should be %d < %d)\n", (no), CGMAX);
WARNING("no is too large (should be %d < %d)", (no), CGMAX);
return NULL;
}
@@ -77,7 +77,7 @@ static cginfo_t *scg_get(int no) {
surface_t *sf = sf_loadcg_no(no - 1);
if (!sf) {
WARNING("load fail (%d)\n", no -1);
WARNING("load fail (%d)", no -1);
return NULL;
}
return scg_new(CG_LINKED, no, sf);
+11 -11
View File
@@ -5,7 +5,7 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
int sw, sh;
int *row, *col;
int x, y;
BYTE *sdata, *ddata;
uint8_t *sdata, *ddata;
dst->width = dw;
dst->height = dh;
@@ -57,14 +57,14 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
#define SCALEDCOPYAREA(type) { \
int x, y; \
type *sl, *dl; \
BYTE *_sl, *_dl; \
uint8_t *_sl, *_dl; \
for (y = 0; y < dh; y++) { \
sl = (type *)(sdata + *(y + col) * src->bytes_per_line);\
dl = (type *)(ddata + y * dst->bytes_per_line);\
for (x = 0; x < dw; x++) { \
*(dl + x) = *(sl + *(row + x)); \
} \
_dl = (BYTE *)dl; \
_dl = (uint8_t *)dl; \
while(*(col + y) == *(col + y + 1)) { \
_sl = _dl; \
_dl += dst->bytes_per_line; \
@@ -75,29 +75,29 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
switch(dst->depth) {
case 8:
SCALEDCOPYAREA(BYTE); break;
SCALEDCOPYAREA(uint8_t); break;
case 16:
SCALEDCOPYAREA(WORD); break;
SCALEDCOPYAREA(uint16_t); break;
case 24:
case 32:
SCALEDCOPYAREA(DWORD); break;
SCALEDCOPYAREA(uint32_t); break;
default:
break;
}
if (src->alpha) {
int x, y;
BYTE *sl, *dl;
BYTE *_sl, *_dl;
uint8_t *sl, *dl;
uint8_t *_sl, *_dl;
sdata = GETOFFSET_ALPHA(src, 0, 0);
ddata = GETOFFSET_ALPHA(dst, 0, 0);
for (y = 0; y < dh; y++) {
sl = (BYTE *)(sdata + *(y + col) * src->width);
dl = (BYTE *)(ddata + y * dst->width);
sl = (uint8_t *)(sdata + *(y + col) * src->width);
dl = (uint8_t *)(ddata + y * dst->width);
for (x = 0; x < dw; x++) {
*(dl + x) = *(sl + *(row + x));
}
_dl = (BYTE *)dl;
_dl = (uint8_t *)dl;
while(*(col + y) == *(col + y + 1)) {
_sl = _dl;
_dl += dst->width;
+5 -5
View File
@@ -32,22 +32,22 @@
*/
int scryp_encrypt_word(int *array, int num, int key) {
WARNING("NOT IMPLEMENTED\n");
WARNING("NOT IMPLEMENTED");
return OK;
}
int scryp_decrypt_word(int *array, int num, int key) {
WARNING("NOT IMPLEMENTED\n");
WARNING("NOT IMPLEMENTED");
return OK;
}
int scryp_encrypt_str(int strno, int key) {
WARNING("NOT IMPLEMENTED\n");
WARNING("NOT IMPLEMENTED");
return OK;
}
int scryp_decrypt_str(int strno, int key) {
WARNING("str = '%s'\n", svar_get(strno));
WARNING("NOT IMPLEMENTED\n");
WARNING("str = '%s'", svar_get(strno));
WARNING("NOT IMPLEMENTED");
return OK;
}
-1
View File
@@ -33,7 +33,6 @@
#include "menu.h"
#include "input.h"
#include "nact.h"
#include "key.h"
#include "sact.h"
#include "sprite.h"
#include "ngraph.h"
+1 -1
View File
@@ -167,7 +167,7 @@ int ssnd_playLRrev(int no) {
// 指定の番号の効果音が存在するかどうかをチェック
int ssnd_getlinknum(int no) {
WARNING("NOT IMPLEMENTED\n");
WARNING("NOT IMPLEMENTED");
return OK;
}
+6 -6
View File
@@ -44,14 +44,14 @@ static int compare_spriteno_smallfirst(const void *a, const void *b);
#define sp_assert_no(no) do { \
if ((no) >= SPRITEMAX) { \
WARNING("no is too large (should be %d < %d)\n", no, SPRITEMAX); \
WARNING("no is too large (should be %d < %d)", no, SPRITEMAX); \
return NG; \
} \
} while (0)
#define sp_assert_null(no) do { \
if (sact.sp[no] == NULL) { \
WARNING("sprite %d is NULL\n", no); \
WARNING("sprite %d is NULL", no); \
return NG; \
} \
} while (0)
@@ -81,7 +81,7 @@ static int sp_draw_wall(sprite_t *sp) {
h = sact.updaterect.h;
gr_fill(sf0, sx, sy, w, h, 0, 0, 0);
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, \n",
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d",
sp->no, sx, sy, w, h);
return OK;
@@ -711,7 +711,7 @@ int sp_sound_set(int wNumSP, int wNumWave1, int wNumWave2, int wNumWave3) {
// すべてのスプライトサウンドの終了を待つ
int sp_sound_wait() {
WARNING("NOT IMPLEMENTED\n");
WARNING("NOT IMPLEMENTED");
return OK;
}
@@ -728,10 +728,10 @@ int sp_sound_ob(int wNumWave) {
* @return: TRUE:入っている, FALSE: 入っていない
*/
boolean sp_is_insprite(sprite_t *sp, int x, int y) {
BYTE *dp;
uint8_t *dp;
if (x < 0 || y < 0 || x >= sf0->width || y >= sf0->height) return FALSE;
dp = GETOFFSET_PIXEL(sact.dmap, x, y);
return (*(WORD *)dp == sp->no);
return (*(uint16_t *)dp == sp->no);
}
+1 -1
View File
@@ -62,7 +62,7 @@ static int eventCB_ANIM(sprite_t *sp, agsevent_t *e) {
sp->curcg = sp->cg3; break;
}
// SACT_DEBUG("anime update\n");
// SACT_DEBUG("anime update");
// カウントアップ
sp->u.anime.tick++;
+10 -10
View File
@@ -35,20 +35,20 @@
#include "ngraph.h"
#include "sprite.h"
static void fill_dmap(int dx ,int dy, int w, int h, WORD val);
static void fill_dmap_mask(surface_t *src, int sx, int sy, int dx ,int dy, int w, int h, WORD val);
static void fill_dmap(int dx ,int dy, int w, int h, uint16_t val);
static void fill_dmap_mask(surface_t *src, int sx, int sy, int dx ,int dy, int w, int h, uint16_t val);
// 矩形の depthmap を描画
static void fill_dmap(int dx ,int dy, int w, int h, WORD val) {
BYTE *dp, *dp_;
static void fill_dmap(int dx ,int dy, int w, int h, uint16_t val) {
uint8_t *dp, *dp_;
int x, y;
dp = dp_ = (GETOFFSET_PIXEL(sact.dmap, dx, dy));
for (x = 0; x < w; x++) {
*((WORD *)dp + x) = val;
*((uint16_t *)dp + x) = val;
}
dp += sact.dmap->bytes_per_line;
@@ -59,16 +59,16 @@ static void fill_dmap(int dx ,int dy, int w, int h, WORD val) {
}
// alphamapにしたがって、alpha値が0より大きいところを指定のdepthとする
static void fill_dmap_mask(surface_t *src, int sx, int sy, int dx ,int dy, int w, int h, WORD val) {
BYTE *sp, *dp;
static void fill_dmap_mask(surface_t *src, int sx, int sy, int dx ,int dy, int w, int h, uint16_t val) {
uint8_t *sp, *dp;
int x, y;
dp = GETOFFSET_PIXEL(sact.dmap, dx, dy);
sp = GETOFFSET_ALPHA(src, sx, sy);
for (y = 0; y < h; y++) {
BYTE *yls = (BYTE *)(sp + y * src->width);
WORD *yld = (WORD *)(dp + y * sact.dmap->bytes_per_line);
uint8_t *yls = (uint8_t *)(sp + y * src->width);
uint16_t *yld = (uint16_t *)(dp + y * sact.dmap->bytes_per_line);
for (x = 0; x < w; x++) {
if (*yls > 0) *yld = val;
yls++; yld++;
@@ -137,7 +137,7 @@ int sp_draw2(sprite_t *sp, cginfo_t *cg) {
}
}
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n", sp->no, sx, sy, w, h, dx, dy);
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d", sp->no, sx, sy, w, h, dx, dy);
return OK;
}
+1 -1
View File
@@ -48,7 +48,7 @@ int sp_eupdate(int type, int time, int cancel) {
enum sdl_effect_type sdl_effect = from_sact_effect(type);
if (sdl_effect == EFFECT_INVALID) {
WARNING("Unimplemented effect %d\n", type);
WARNING("Unimplemented effect %d", type);
type = EFFECT_CROSSFADE;
}
SDL_Rect rect = { 0, 0, sf0->width, sf0->height };
+20 -18
View File
@@ -24,6 +24,9 @@
#include "config.h"
#include <stdio.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#include "portab.h"
#include "system.h"
@@ -31,7 +34,6 @@
#include "menu.h"
#include "input.h"
#include "nact.h"
#include "key.h"
#include "sact.h"
#include "sprite.h"
#include "sactsound.h"
@@ -91,7 +93,7 @@ static void cb_focused_swsp(void* s, void* data) {
int *update = (int *)data;
boolean oldstate = sp->show;
SACT_DEBUG("show up spex %d\n", sp->no);
SACT_DEBUG("show up spex %d", sp->no);
sp->show = TRUE;
if (oldstate != sp->show) {
@@ -109,7 +111,7 @@ static void cb_defocused_swsp(void* s, void* data) {
int *update = (int *)data;
boolean oldstate = sp->show;
SACT_DEBUG("hide spex %d\n", sp->no);
SACT_DEBUG("hide spex %d", sp->no);
sp->show = FALSE;
if (oldstate != sp->show) {
@@ -173,7 +175,7 @@ static int cb_focused(sprite_t *sp) {
update++;
}
sp->focused = TRUE;
SACT_DEBUG("get forcused %d, type %d\n", sp->no, sp->type);
SACT_DEBUG("get forcused %d, type %d", sp->no, sp->type);
if (sp->numsound1) {
ssnd_play(sp->numsound1);
}
@@ -196,7 +198,7 @@ static int cb_defocused(sprite_t *sp) {
sp->curcg = sp->cg1;
update++;
sp->focused = FALSE;
SACT_DEBUG("lost forcused %d\n", sp->no);
SACT_DEBUG("lost forcused %d", sp->no);
}
return update;
@@ -210,7 +212,7 @@ static void cb_waitkey_simple(agsevent_t *e) {
switch (e->type) {
case AGSEVENT_KEY_PRESS:
if (e->d3 == KEY_Z) {
if (e->code == KEY_Z) {
cur = sdl_getTicks();
if (!sact.zhiding) {
slist_foreach(sact.sp_zhide, cb_defocused_zkey, &update);
@@ -239,7 +241,7 @@ static void cb_waitkey_simple(agsevent_t *e) {
// fall through
case AGSEVENT_KEY_RELEASE:
switch(e->d3) {
switch(e->code) {
case KEY_Z:
cur = sdl_getTicks();
if (500 < (cur - sact.zofftime) || !sact.zdooff) {
@@ -255,7 +257,7 @@ static void cb_waitkey_simple(agsevent_t *e) {
sact.waittype = KEYWAIT_BACKLOG;
break;
default:
sact.waitkey = e->d3;
sact.waitkey = e->code;
break;
}
}
@@ -289,7 +291,7 @@ void cb_waitkey_sprite(agsevent_t *e) {
// 右クリックキャンセル
// drag中でない時のみ、キャンセルを受け付ける
if (e->type == AGSEVENT_BUTTON_RELEASE &&
e->d3 == AGSEVENT_BUTTON_RIGHT) {
e->code == AGSEVENT_BUTTON_RIGHT) {
sact.waitkey = 0;
return;
}
@@ -308,7 +310,7 @@ void cb_waitkey_sprite(agsevent_t *e) {
// dragg中の sprite は無視する
if (sp == sact.draggedsp) continue;
if (focused_sp == NULL && sp_is_insprite(sp, e->d1, e->d2)) {
if (focused_sp == NULL && sp_is_insprite(sp, e->mousex, e->mousey)) {
/*
focusを得ている sprite
*/
@@ -385,8 +387,8 @@ static void cb_waitkey_selection(agsevent_t *e) {
static void cb_waitkey_backlog(agsevent_t *e) {
switch (e->type) {
case AGSEVENT_KEY_RELEASE:
switch (e->d3) {
case KEY_ESC:
switch (e->code) {
case KEY_ESCAPE:
sblog_end();
sact.waittype = KEYWAIT_MESSAGE;
break;
@@ -406,14 +408,14 @@ static void cb_waitkey_backlog(agsevent_t *e) {
break;
case AGSEVENT_BUTTON_RELEASE:
if (e->d3 == AGSEVENT_BUTTON_RIGHT) {
if (e->code == AGSEVENT_BUTTON_RIGHT) {
sblog_end();
sact.waittype = KEYWAIT_MESSAGE;
}
break;
case AGSEVENT_MOUSE_WHEEL:
if (e->d3 > 0)
if (e->code > 0)
sblog_pagenext();
else
sblog_pagepre();
@@ -431,15 +433,15 @@ void spev_callback(agsevent_t *e) {
}
if (sact.waittype != KEYWAIT_BACKLOG) {
if (e->type == AGSEVENT_KEY_PRESS && e->d3 == KEY_CTRL) {
if (e->type == AGSEVENT_KEY_PRESS && e->code == KEY_CTRL) {
sact.waitskiplv = 2;
sact.waitkey = e->d3;
sact.waitkey = e->code;
return;
}
if (e->type == AGSEVENT_KEY_RELEASE && e->d3 == KEY_CTRL) {
if (e->type == AGSEVENT_KEY_RELEASE && e->code == KEY_CTRL) {
sact.waitskiplv = 0;
sact.waitkey = e->d3;
sact.waitkey = e->code;
return;
}
}
+5 -5
View File
@@ -58,12 +58,12 @@ static int eventCB_GET(sprite_t *sp, agsevent_t *e) {
switch(e->type) {
case AGSEVENT_BUTTON_PRESS:
if (e->d3 != AGSEVENT_BUTTON_LEFT) break;
if (e->code != AGSEVENT_BUTTON_LEFT) break;
// drag開始時のマウスの位置記録
sp->u.get.dragging = TRUE;
sp->u.get.dragstart.x = e->d1;
sp->u.get.dragstart.y = e->d2;
sp->u.get.dragstart.x = e->mousex;
sp->u.get.dragstart.y = e->mousey;
if (sp->cg3) {
sp->curcg = sp->cg3;
@@ -104,8 +104,8 @@ static int eventCB_GET(sprite_t *sp, agsevent_t *e) {
// if (!sp->u.get.dragging) break;
// マウスの現在位置により新しい場所を計算
newx = sp->loc.x + (e->d1 - sp->u.get.dragstart.x);
newy = sp->loc.y + (e->d2 - sp->u.get.dragstart.y);
newx = sp->loc.x + (e->mousex - sp->u.get.dragstart.x);
newy = sp->loc.y + (e->mousey - sp->u.get.dragstart.y);
if (newx != sp->cur.x || newy != sp->cur.y) {
sp_updateme(sp);
sp->cur.x = newx;
+5 -5
View File
@@ -135,13 +135,13 @@ int sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeout
{
// とりあえず、現在のマウス位置を送って、switch sprite の
// 状態を更新しておく
agsevent_t agse;
MyPoint p;
sys_getMouseInfo(&p, FALSE);
agse.type = AGSEVENT_MOUSE_MOTION;
agse.d1 = p.x;
agse.d2 = p.y;
agse.d3 = 0;
agsevent_t agse = {
.type = AGSEVENT_MOUSE_MOTION,
.mousex = p.x,
.mousey = p.y
};
spev_callback(&agse);
}
+2 -2
View File
@@ -75,7 +75,7 @@ static int move_cb(sprite_t *sp, agsevent_t *e) {
// 現在時刻の取得
now = sact.movecurtime;
SACT_DEBUG("no = %d now = %d st = %d, ed = %d\n",
SACT_DEBUG("no = %d now = %d st = %d, ed = %d",
sp->no, now, sp->move.starttime, sp->move.endtime);
if (now >= sp->move.endtime) {
@@ -139,7 +139,7 @@ void spev_move_setup(void* data, void* userdata) {
// タイマコールバック登録
spev_add_teventlistener(sp, move_cb);
SACT_DEBUG("no=%d,from(%d,%d@%d)to(%d,%d@%d),time=%d\n", sp->no,
SACT_DEBUG("no=%d,from(%d,%d@%d)to(%d,%d@%d),time=%d", sp->no,
sp->cur.x, sp->cur.y, sp->move.starttime,
sp->move.to.x, sp->move.to.y, sp->move.endtime,
sp->move.time);
+8 -8
View File
@@ -51,8 +51,8 @@ static void replacestr_cb(void* data, void* userdata);
static char *replacestr(char *msg);
static void update_mark(sprite_t *sp, cginfo_t *cg);
static int setupmark(int wNum1, int wNum2, struct markinfo *minfo);
static int get_linelen(BYTE *msg);
static BYTE *get_char(BYTE *msg, char *mbuf, char *rbuf, int bufmax);
static int get_linelen(uint8_t *msg);
static uint8_t *get_char(uint8_t *msg, char *mbuf, char *rbuf, int bufmax);
static void append_to_log(char *msg);
static void sactlog_newline();
static void set_align(char *msg, sprite_t *sp, int wSize, int wAlign);
@@ -194,7 +194,7 @@ void smsg_add(const char *msg) {
len = MSGBUFMAX - (int)strlen(sact.msgbuf);
if (len < 0) {
WARNING("buf shortage (%d)\n", len);
WARNING("buf shortage (%d)", len);
return;
}
@@ -210,7 +210,7 @@ void smsg_add(const char *msg) {
@param size:
*/
void smsg_newline(int wNum, int size) {
BYTE buf[3];
uint8_t buf[3];
if (!is_messagesprite(wNum)) return;
@@ -461,14 +461,14 @@ int smsg_update(sprite_t *sp) {
gre_BlendUseAMap(sf0, dx, dy, sf0, dx, dy, sp->u.msg.canvas, sx, sy, w, h, sp->u.msg.canvas, sx, sy, sp->blendrate);
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n",
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d",
sp->no, sx, sy, w, h, dx, dy);
return OK;
}
// 改行を含む文字列バッファ中から、改行までの文字列の長さを取り出す
static int get_linelen(BYTE *msg) {
static int get_linelen(uint8_t *msg) {
int c = 0;
while (*msg) {
@@ -494,7 +494,7 @@ static int get_linelen(BYTE *msg) {
// 改行の場合 : 改行幅もいっしょに
// ルビつき文字の場合: メッセージ本体と対応するルビ文字列
// それ以外 : 全角|半角文字1文字
static BYTE *get_char(BYTE *msg, char *mbuf, char *rbuf, int bufmax) {
static uint8_t *get_char(uint8_t *msg, char *mbuf, char *rbuf, int bufmax) {
if (msg[0] == '\n') {
mbuf[0] = '\n';
mbuf[1] = msg[1];
@@ -515,7 +515,7 @@ static BYTE *get_char(BYTE *msg, char *mbuf, char *rbuf, int bufmax) {
}
msg++; rbuf[i] = '\0';
} else {
BYTE *p = advance_char(msg, nact->encoding);
uint8_t *p = advance_char(msg, nact->encoding);
while (msg < p)
*mbuf++ = *msg++;
*mbuf = '\0';
+1 -1
View File
@@ -40,7 +40,7 @@ static int eventCB_PUT(sprite_t *sp, agsevent_t *e) {
switch(e->type) {
case AGSEVENT_BUTTON_PRESS:
if (e->d3 != AGSEVENT_BUTTON_LEFT) return 0;
if (e->code != AGSEVENT_BUTTON_LEFT) return 0;
// ボタン押下時のスプライトがあれば、それを表示
if (sp->cg3) {
+7 -6
View File
@@ -31,7 +31,6 @@
#include "nact.h"
#include "ags.h"
#include "input.h"
#include "key.h"
#include "sact.h"
#include "sprite.h"
#include "ngraph.h"
@@ -77,7 +76,7 @@ static boolean sp_is_insprite2(sprite_t *sp, int x, int y, int margin) {
// マウスが移動したときの callback
static void cb_select_move(agsevent_t *e) {
int x = e->d1, y = e->d2;
int x = e->mousex, y = e->mousey;
sprite_t *sp = sact.sp[sact.sel.spno];
boolean newstate;
int newindex;
@@ -115,12 +114,12 @@ static void cb_select_move(agsevent_t *e) {
// ボタンがリリースされたときの callback
static void cb_select_release(agsevent_t *e) {
int x = e->d1, y = e->d2;
int x = e->mousex, y = e->mousey;
sprite_t *sp = sact.sp[sact.sel.spno];
boolean st;
int iy;
switch (e->d3) {
switch (e->code) {
case AGSEVENT_BUTTON_LEFT:
st = sp_is_insprite2(sp, x, y, sact.sel.frame_dot);
iy = (y - (sp->cur.y + sact.sel.frame_dot)) / (sact.sel.font_size + sact.sel.linespace);
@@ -198,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;
+2 -2
View File
@@ -41,7 +41,7 @@ static int eventCB_switch(sprite_t *sp, agsevent_t *e) {
switch(e->type) {
case AGSEVENT_BUTTON_PRESS:
if (e->d3 != AGSEVENT_BUTTON_LEFT) return 0;
if (e->code != AGSEVENT_BUTTON_LEFT) return 0;
// ボタン押下時のスプライトがあれば、それを表示
if (sp->cg3) {
@@ -53,7 +53,7 @@ static int eventCB_switch(sprite_t *sp, agsevent_t *e) {
break;
case AGSEVENT_BUTTON_RELEASE:
if (e->d3 != AGSEVENT_BUTTON_LEFT) return 0;
if (e->code != AGSEVENT_BUTTON_LEFT) return 0;
// ここにくるときは forcusが当たっているときしかこないので、
// curcg は cg2 に戻せばよい
+3 -3
View File
@@ -64,7 +64,7 @@ static void get_updatearea() {
// surface0との領域の積をとる
SDL_IntersectRect(&rsf0, &clip, &sact.updaterect);
SACT_DEBUG("clipped area x=%d y=%d w=%d h=%d\n",
SACT_DEBUG("clipped area x=%d y=%d w=%d h=%d",
sact.updaterect.x, sact.updaterect.y,
sact.updaterect.w, sact.updaterect.h);
@@ -168,7 +168,7 @@ int sp_updateme(sprite_t *sp) {
updatearea = slist_append(updatearea, r);
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d\n",
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d",
r->x, r->y, sp->no, r->w, r->h);
return OK;
@@ -196,7 +196,7 @@ int sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
updatearea = slist_append(updatearea, r);
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d\n",
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d",
r->x, r->y, sp->no, r->w, r->h);
return OK;
+59 -60
View File
@@ -49,7 +49,7 @@ static void GetAtArray(void) { /* 0 */
int *vResult = getCaliVariable();
int i, j;
DEBUG_COMMAND("ShArray.GetAtArray %p,%d,%d,%p:\n", vAry, cnt, type, vResult);
DEBUG_COMMAND("ShArray.GetAtArray %p,%d,%d,%p:", vAry, cnt, type, vResult);
j = *vAry; vAry++;
for (i = 1; i < cnt; i++) {
@@ -93,7 +93,7 @@ static void AddAtArray(void) { /* 1 */
int cnt = getCaliValue();
int i;
DEBUG_COMMAND("ShArray.AddAtArray %p,%p,%d:\n", vAry1, vAry2, cnt);
DEBUG_COMMAND("ShArray.AddAtArray %p,%p,%d:", vAry1, vAry2, cnt);
for (i = 0; i < cnt; i++) {
int result = (*vAry1) + (*vAry2);
@@ -119,7 +119,7 @@ static void SubAtArray(void) { /* 2 */
int cnt = getCaliValue();
int i;
DEBUG_COMMAND("ShArray.SubAtArray %p,%p,%d:\n", vAry1, vAry2, cnt);
DEBUG_COMMAND("ShArray.SubAtArray %p,%p,%d:", vAry1, vAry2, cnt);
for (i = 0; i < cnt; i++) {
int result = (*vAry1) - (*vAry2);
@@ -145,7 +145,7 @@ static void MulAtArray(void) { /* 3 */
int cnt = getCaliValue();
int i;
DEBUG_COMMAND("ShArray.MulAtArray %p,%p,%d:\n", vAry1, vAry2, cnt);
DEBUG_COMMAND("ShArray.MulAtArray %p,%p,%d:", vAry1, vAry2, cnt);
for (i = 0; i < cnt; i++) {
int result = (*vAry1) * (*vAry2);
@@ -171,7 +171,7 @@ static void DivAtArray(void) { /* 4 */
int cnt = getCaliValue();
int i;
DEBUG_COMMAND("ShArray.DivAtArray: %d,%d,%d:\n", vAry1, vAry2, cnt);
DEBUG_COMMAND("ShArray.DivAtArray: %d,%d,%d:", vAry1, vAry2, cnt);
for (i = 0; i < cnt; i++) {
if (*vAry2 == 0) {
@@ -201,7 +201,7 @@ static void MinAtArray(void) { /* 5 */
int cnt = getCaliValue();
int i;
DEBUG_COMMAND("ShArray.MinAtArray: %d,%d,%d:\n", vAry1, vAry2, cnt);
DEBUG_COMMAND("ShArray.MinAtArray: %d,%d,%d:", vAry1, vAry2, cnt);
for (i = 0; i < cnt; i++) {
if (*vAry1 < *vAry2) {
@@ -224,7 +224,7 @@ static void MaxAtArray(void) { /* 6 */
int cnt = getCaliValue();
int i;
DEBUG_COMMAND("ShArray.MaxAtArray: %d,%d,%d:\n", vAry1, vAry2, cnt);
DEBUG_COMMAND("ShArray.MaxAtArray: %d,%d,%d:", vAry1, vAry2, cnt);
for (i = 0; i < cnt; i++) {
if (*vAry1 > *vAry2) {
@@ -247,7 +247,7 @@ static void AndNumArray(void) { /* 7 */
int val = getCaliValue();
int i;
DEBUG_COMMAND("ShArray.AndNumArray: %p,%d,%d:\n", vAry, cnt, val);
DEBUG_COMMAND("ShArray.AndNumArray: %p,%d,%d:", vAry, cnt, val);
for (i = 0; i < cnt; i++) {
(*vAry) &= val;
@@ -268,7 +268,7 @@ static void OrNumArray(void) { /* 8 */
int val = getCaliValue();
int i;
DEBUG_COMMAND_YET("ShArray.OrNumArray: %p,%d,%d:\n", vAry, cnt, val);
DEBUG_COMMAND_YET("ShArray.OrNumArray: %p,%d,%d:", vAry, cnt, val);
for (i = 0; i < cnt; i++) {
(*vAry) |= val;
@@ -289,7 +289,7 @@ static void XorNumArray(void) { /* 9 */
int val = getCaliValue();
int i;
DEBUG_COMMAND("ShArray.XorNumArray %p,%d,%d:\n", vAry, cnt, val);
DEBUG_COMMAND("ShArray.XorNumArray %p,%d,%d:", vAry, cnt, val);
for (i = 0; i < cnt; i++) {
(*vAry) ^= val;
@@ -313,7 +313,7 @@ static void SetEquArray(void) { /* 10 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.SetEquArray %p,%d,%d,%p:\n", vAry, cnt, val, vResults);
DEBUG_COMMAND("ShArray.SetEquArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
for (i = 0; i < cnt; i++) {
*vResults = (*vAry == val) ? 1 : 0;
@@ -337,7 +337,7 @@ static void SetNotArray(void) { /* 11 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.SetNotArray %p,%d,%d,%p:\n", vAry, cnt, val, vResults);
DEBUG_COMMAND("ShArray.SetNotArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
for (i = 0; i < cnt; i++) {
*vResults = (*vAry != val) ? 1 : 0;
@@ -360,7 +360,7 @@ static void SetLowArray(void) { /* 12 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.SetLowArray %p,%d,%d,%p:\n", vAry, cnt, val, vResults);
DEBUG_COMMAND("ShArray.SetLowArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
for (i = 0; i < cnt; i++) {
(*vResults) = ((*vAry < val) ? 1 : 0);
@@ -383,7 +383,7 @@ static void SetHighArray(void) { /* 13 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.SetHighArray %p,%d,%d,%p:\n", vAry, cnt, val, vResults);
DEBUG_COMMAND("ShArray.SetHighArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
for (i = 0; i < cnt; i++) {
(*vResults) = ((*vAry > val) ? 1 : 0);
@@ -410,7 +410,7 @@ static void SetRangeArray(void) { /* 14 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.SetRangeArray %p,%d,%d,%d,%p:\n", vAry, cnt, min, max, vResults);
DEBUG_COMMAND("ShArray.SetRangeArray %p,%d,%d,%d,%p:", vAry, cnt, min, max, vResults);
for (i = 0; i < cnt; i++) {
*vResults = ((*vAry > min) && (*vAry < max)) ? 1 : 0;
@@ -437,7 +437,7 @@ static void SetAndEquArray(void) { /* 15 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.SetAndEquArray: %p,%d,%d,%d,%p:\n", vAry, mask, cnt, val, vResults);
DEBUG_COMMAND("ShArray.SetAndEquArray: %p,%d,%d,%d,%p:", vAry, mask, cnt, val, vResults);
for (i = 0; i < cnt; i++) {
*vResults = ((*vAry & mask) == val) ? 1 : 0;
@@ -461,7 +461,7 @@ static void AndEquArray(void) { /* 16 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.AndEquArray %p,%d,%d,%p:\n", vAry, cnt, val, vResults);
DEBUG_COMMAND("ShArray.AndEquArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
for (i = 0; i < cnt; i++) {
*vResults &= ((*vAry == val) ? 1 : 0);
@@ -485,7 +485,7 @@ static void AndNotArray(void) { /* 17 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.AndNotArray %p,%d,%d,%p:\n", vAry, cnt, val, vResults);
DEBUG_COMMAND("ShArray.AndNotArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
for (i = 0; i < cnt; i++) {
*vResults &= ((*vAry != val) ? 1 : 0);
@@ -509,7 +509,7 @@ static void AndLowArray(void) { /* 18 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.AndLowArray: %d,%d,%d,%d:\n", vAry, cnt, min, vResults);
DEBUG_COMMAND("ShArray.AndLowArray: %d,%d,%d,%d:", vAry, cnt, min, vResults);
for (i = 0; i < cnt; i++) {
*vResults &= ((*vAry < min) ? 1 : 0);
@@ -533,7 +533,7 @@ static void AndHighArray(void) { /* 19 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.AndHighArray: %p,%d,%d,%p:\n", vAry, cnt, max, vResults);
DEBUG_COMMAND("ShArray.AndHighArray: %p,%d,%d,%p:", vAry, cnt, max, vResults);
for (i = 0; i < cnt; i++) {
*vResults &= ((*vAry > max) ? 1 : 0);
@@ -559,7 +559,7 @@ static void AndRangeArray(void) { /* 20 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.AndRangeArray %d,%d,%d,%d,%d:\n", vAry, cnt, min, max, vResults);
DEBUG_COMMAND("ShArray.AndRangeArray %d,%d,%d,%d,%d:", vAry, cnt, min, max, vResults);
for (i = 0; i < cnt; i++) {
*vResults &= (((*vAry > min) && (*vAry < max)) ? 1 : 0);
@@ -586,7 +586,7 @@ static void AndAndEquArray(void) { /* 21 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.AndAndEquArray: %d,%d,%d,%d,%d:\n", vAry, mask, cnt, val, vResults);
DEBUG_COMMAND("ShArray.AndAndEquArray: %d,%d,%d,%d,%d:", vAry, mask, cnt, val, vResults);
for (i = 0; i < cnt; i++) {
(*vResults) &= (((*vAry & mask) == val) ? 1 : 0);
@@ -600,7 +600,7 @@ static void OrEquArray(void) { /* 22 */
int p3 = getCaliValue();
int p4 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.OrEquArray: %d,%d,%d,%d:\n", p1, p2, p3, p4);
DEBUG_COMMAND_YET("ShArray.OrEquArray: %d,%d,%d,%d:", p1, p2, p3, p4);
}
static void OrNotArray(void) { /* 23 */
@@ -618,7 +618,7 @@ static void OrNotArray(void) { /* 23 */
int *vResults = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.OrNotArray %p,%d,%d,%p:\n", vAry, cnt, val, vResults);
DEBUG_COMMAND("ShArray.OrNotArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
for (i = 0; i < cnt; i++) {
// if (*vAry != val) *vResults = 1;
@@ -633,7 +633,7 @@ static void OrLowArray(void) { /* 24 */
int p3 = getCaliValue();
int p4 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.OrLowArray: %d,%d,%d,%d:\n", p1, p2, p3, p4);
DEBUG_COMMAND_YET("ShArray.OrLowArray: %d,%d,%d,%d:", p1, p2, p3, p4);
}
static void OrHighArray(void) { /* 25 */
@@ -642,7 +642,7 @@ static void OrHighArray(void) { /* 25 */
int p3 = getCaliValue();
int p4 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.OrHighArray: %d,%d,%d,%d:\n", p1, p2, p3, p4);
DEBUG_COMMAND_YET("ShArray.OrHighArray: %d,%d,%d,%d:", p1, p2, p3, p4);
}
static void OrRangeArray(void) { /* 26 */
@@ -652,7 +652,7 @@ static void OrRangeArray(void) { /* 26 */
int p4 = getCaliValue();
int p5 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.OrRangeArray: %d,%d,%d,%d,%d:\n", p1, p2, p3, p4,p5);
DEBUG_COMMAND_YET("ShArray.OrRangeArray: %d,%d,%d,%d,%d:", p1, p2, p3, p4,p5);
}
static void OrAndEquArray(void) { /* 27 */
@@ -662,7 +662,7 @@ static void OrAndEquArray(void) { /* 27 */
int p4 = getCaliValue();
int p5 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.OrAndEquArray: %d,%d,%d,%d,%d:\n", p1, p2, p3, p4,p5);
DEBUG_COMMAND_YET("ShArray.OrAndEquArray: %d,%d,%d,%d,%d:", p1, p2, p3, p4,p5);
}
static void EnumEquArray(void) { /* 28 */
@@ -680,7 +680,7 @@ static void EnumEquArray(void) { /* 28 */
int *vResult = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.EnumEquArray %p,%d,%d,%p:\n", vAry, cnt, val, vResult);
DEBUG_COMMAND("ShArray.EnumEquArray %p,%d,%d,%p:", vAry, cnt, val, vResult);
*vResult = 0;
@@ -698,7 +698,7 @@ static void EnumEquArray2(void) { /* 29 */
int p5 = getCaliValue();
int p6 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.EnumEquArray2: %d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6);
DEBUG_COMMAND_YET("ShArray.EnumEquArray2: %d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6);
}
static void EnumEquNotArray2(void) { /* 30 */
@@ -721,7 +721,7 @@ static void EnumEquNotArray2(void) { /* 30 */
int *vResult = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.EnumEquNotArray2 %p,%p,%d,%d,%d,%p:\n", vAry1, vAry2, cnt, val1, val2, vResult);
DEBUG_COMMAND("ShArray.EnumEquNotArray2 %p,%p,%d,%d,%d,%p:", vAry1, vAry2, cnt, val1, val2, vResult);
*vResult = 0;
@@ -748,7 +748,7 @@ static void EnumNotArray(void) { /* 31 */
int *vResult = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.EnumNotArray %p, %d, %d, %p:\n", vAry, cnt, val, vResult);
DEBUG_COMMAND("ShArray.EnumNotArray %p, %d, %d, %p:", vAry, cnt, val, vResult);
*vResult = 0;
@@ -768,7 +768,7 @@ static void EnumNotArray2(void) { /* 32 */
int p5 = getCaliValue();
int p6 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.EnumNotArray2: %d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6);
DEBUG_COMMAND_YET("ShArray.EnumNotArray2: %d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6);
}
static void EnumLowArray(void) { /* 33 */
@@ -777,7 +777,7 @@ static void EnumLowArray(void) { /* 33 */
int p3 = getCaliValue();
int p4 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.EnumLowArray: %d,%d,%d,%d:\n", p1, p2, p3, p4);
DEBUG_COMMAND_YET("ShArray.EnumLowArray: %d,%d,%d,%d:", p1, p2, p3, p4);
}
static void EnumHighArray(void) { /* 34 */
@@ -786,7 +786,7 @@ static void EnumHighArray(void) { /* 34 */
int p3 = getCaliValue();
int p4 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.EnumHighArray: %d,%d,%d,%d:\n", p1, p2, p3, p4);
DEBUG_COMMAND_YET("ShArray.EnumHighArray: %d,%d,%d,%d:", p1, p2, p3, p4);
}
static void EnumRangeArray(void) { /* 35 */
@@ -806,7 +806,7 @@ static void EnumRangeArray(void) { /* 35 */
int *vResult = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.EnumRangeArray %d,%d,%d,%d,%d:\n", vAry, cnt, min, max, vResult);
DEBUG_COMMAND("ShArray.EnumRangeArray %d,%d,%d,%d,%d:", vAry, cnt, min, max, vResult);
*vResult = 0;
@@ -837,7 +837,7 @@ static void GrepEquArray(void) { /* 36 */
int *vResult = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.GrepEquArray %p,%d,%d,%p,%p:\n", vAry, cnt, val, vMatch, vResult);
DEBUG_COMMAND("ShArray.GrepEquArray %p,%d,%d,%p,%p:", vAry, cnt, val, vMatch, vResult);
*vResult = 0;
@@ -869,7 +869,7 @@ static void GrepNotArray(void) { /* 37 */
int *vResult = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.GrepNotArray %p,%d,%d,%p,%p:\n", vAry, cnt, val, vMatch, vResult);
DEBUG_COMMAND("ShArray.GrepNotArray %p,%d,%d,%p,%p:", vAry, cnt, val, vMatch, vResult);
*vResult = 0;
@@ -892,7 +892,7 @@ static void GrepEquArray2(void) { /* 38 */
int p6 = getCaliValue();
int p7 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.GrepEquArray2: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7);
DEBUG_COMMAND_YET("ShArray.GrepEquArray2: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7);
}
static void GrepNotArray2(void) { /* 39 */
@@ -904,7 +904,7 @@ static void GrepNotArray2(void) { /* 39 */
int p6 = getCaliValue();
int p7 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.GrepNotArray2: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7);
DEBUG_COMMAND_YET("ShArray.GrepNotArray2: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7);
}
static void GrepEquNotArray2(void) { /* 40 */
@@ -916,7 +916,7 @@ static void GrepEquNotArray2(void) { /* 40 */
int p6 = getCaliValue();
int p7 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.GrepEquNotArray2: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7);
DEBUG_COMMAND_YET("ShArray.GrepEquNotArray2: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7);
}
static void GrepLowArray(void) { /* 41 */
@@ -937,7 +937,7 @@ static void GrepLowArray(void) { /* 41 */
int *vResult = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.GrepLowArray: %p,%d,%d,%p,%p:\n", vAry, cnt, min, vMatch, vResult);
DEBUG_COMMAND("ShArray.GrepLowArray: %p,%d,%d,%p,%p:", vAry, cnt, min, vMatch, vResult);
*vResult = 0;
@@ -969,7 +969,7 @@ static void GrepHighArray(void) { /* 42 */
int *vResult = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.GrepHighArray: %p,%d,%d,%p,%p:\n", vAry, cnt, max, vMatch, vResult);
DEBUG_COMMAND("ShArray.GrepHighArray: %p,%d,%d,%p,%p:", vAry, cnt, max, vMatch, vResult);
*vResult = 0;
@@ -1003,7 +1003,7 @@ static void GrepRangeArray(void) { /* 43 */
int *vResult = getCaliVariable();
int i;
DEBUG_COMMAND("ShArray.GrepRangeArray %p,%d,%d,%d,%p,%p:\n", vAry, cnt, max, min, vMatch, vResult);
DEBUG_COMMAND("ShArray.GrepRangeArray %p,%d,%d,%d,%p,%p:", vAry, cnt, max, min, vMatch, vResult);
*vResult = 0;
@@ -1040,7 +1040,7 @@ static void GrepLowOrderArray(void) { /* 44 */
int *vResult = getCaliVariable();
int i, j, k = 0;
DEBUG_COMMAND("ShArray.GrepLowOrderArray %p,%d,%d,%d,%p,%p,%p:\n", vAry, cnt, min, max, v1, vLastMatch, vResult);
DEBUG_COMMAND("ShArray.GrepLowOrderArray %p,%d,%d,%d,%p,%p,%p:", vAry, cnt, min, max, v1, vLastMatch, vResult);
*vResult = 0;
for (i = 0; i < cnt; i++) {
@@ -1091,7 +1091,7 @@ static void GrepHighOrderArray(void) { /* 45 */
int *vResult = getCaliVariable();
int i, j, k = 0;
DEBUG_COMMAND("ShArray.GrepHighOrderArray %p,%d,%d,%d,%p,%p,%p:\n", vAry, cnt, min, max, v1, vLastMatch, vResult);
DEBUG_COMMAND("ShArray.GrepHighOrderArray %p,%d,%d,%d,%p,%p,%p:", vAry, cnt, min, max, v1, vLastMatch, vResult);
*vResult = 0;
for (i = 0; i < cnt; i++) {
@@ -1125,7 +1125,7 @@ static void ChangeEquArray(void) { /* 46 */
int dst = getCaliValue();
int i;
DEBUG_COMMAND("ShArray.ChangeEquArray: %d,%d,%d,%d:\n", vAry, cnt, src, dst);
DEBUG_COMMAND("ShArray.ChangeEquArray: %d,%d,%d,%d:", vAry, cnt, src, dst);
for (i = 0; i < cnt; i++) {
if (*vAry == src) {
@@ -1141,7 +1141,7 @@ static void ChangeNotArray(void) { /* 47 */
int p3 = getCaliValue();
int p4 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.ChangeNotArray: %d,%d,%d,%d:\n", p1, p2, p3, p4);
DEBUG_COMMAND_YET("ShArray.ChangeNotArray: %d,%d,%d,%d:", p1, p2, p3, p4);
}
static void ChangeLowArray(void) { /* 48 */
@@ -1150,7 +1150,7 @@ static void ChangeLowArray(void) { /* 48 */
int p3 = getCaliValue();
int p4 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.ChangeLowArray: %d,%d,%d,%d:\n", p1, p2, p3, p4);
DEBUG_COMMAND_YET("ShArray.ChangeLowArray: %d,%d,%d,%d:", p1, p2, p3, p4);
}
static void ChangeHighArray(void) { /* 49 */
@@ -1159,7 +1159,7 @@ static void ChangeHighArray(void) { /* 49 */
int p3 = getCaliValue();
int p4 = getCaliValue();
DEBUG_COMMAND_YET("ShArray.ChangeHighArray: %d,%d,%d,%d:\n", p1, p2, p3, p4);
DEBUG_COMMAND_YET("ShArray.ChangeHighArray: %d,%d,%d,%d:", p1, p2, p3, p4);
}
static void ChangeRangeArray(void) { /* 50 */
@@ -1179,7 +1179,7 @@ static void ChangeRangeArray(void) { /* 50 */
int val = getCaliValue();
int i;
DEBUG_COMMAND("ShArray.ChangeRangeArray %p,%d,%d,%d,%d:\n", vAry, cnt, min, max, val);
DEBUG_COMMAND("ShArray.ChangeRangeArray %p,%d,%d,%d,%d:", vAry, cnt, min, max, val);
for (i = 0; i < cnt; i++) {
if ((*vAry > min) && (*vAry < max)) {
@@ -1212,7 +1212,7 @@ static void CopyArrayToRect(void) { /* 51 */
int dh = getCaliValue();
int x, y;
DEBUG_COMMAND("ShArray.CopyArrayToRect %p,%d,%d,%d,%d,%p,%d,%d:\n", vSrc, sw, sh, sx, sy, vDst, dw, dh);
DEBUG_COMMAND("ShArray.CopyArrayToRect %p,%d,%d,%d,%d,%p,%d,%d:", vSrc, sw, sh, sx, sy, vDst, dw, dh);
vSrc += (sy * sw + sx);
for (y = 0; y < dh; y++) {
@@ -1246,7 +1246,7 @@ static void CopyRectToArray(void) { /* 52 */
int dy = getCaliValue();
int x, y;
DEBUG_COMMAND("ShArray.CopyRectToArray %p,%d,%d,%p,%d,%d,%d,%d:\n", vSrc, sw, sh, vDst, dw, dh, dx, dy);
DEBUG_COMMAND("ShArray.CopyRectToArray %p,%d,%d,%p,%d,%d,%d,%d:", vSrc, sw, sh, vDst, dw, dh, dx, dy);
vDst += (dy * dw + dx);
for (y = 0; y < sh; y++) {
@@ -1270,9 +1270,9 @@ static void ChangeSecretArray(void) { /* 53 */
int cnt = getCaliValue();
int type = getCaliValue();
int *vResult = getCaliVariable();
static WORD key[4] = { 0x7A7A, 0xADAD, 0xBCBC, 0xCECE }; /* key */
static uint16_t key[4] = { 0x7A7A, 0xADAD, 0xBCBC, 0xCECE }; /* key */
DEBUG_COMMAND("ShArray.ChangeSecretArray %p,%d,%d,%p:\n", vAry, cnt, type, vResult);
DEBUG_COMMAND("ShArray.ChangeSecretArray %p,%d,%d,%p:", vAry, cnt, type, vResult);
*vResult = 0;
@@ -1301,12 +1301,12 @@ static void ChangeSecretArray(void) { /* 53 */
*/
int i, j = 0;
WORD ax = key[3] ^ 0x5a5a;
uint16_t ax = key[3] ^ 0x5a5a;
for (i = 0; i < cnt; i++) {
(*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);
@@ -1322,19 +1322,18 @@ static void ChangeSecretArray(void) { /* 53 */
*/
int i, j = 0, k;
WORD ax = key[3] ^ 0x5a5a;
uint16_t ax = key[3] ^ 0x5a5a;
for (i = 0; i < cnt; i++) {
k = *vAry;
*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;
}
+23 -23
View File
@@ -62,7 +62,7 @@ static void SetIntNumBase(void) { /* 0 */
numbase = base;
DEBUG_COMMAND("ShCalc.SetIntNumBase %d:\n", base);
DEBUG_COMMAND("ShCalc.SetIntNumBase %d:", base);
}
@@ -76,13 +76,13 @@ static void SetIntNum16(void) { /* 1 */
l_1000A0D8 = mul64(*var, numbase);
DEBUG_COMMAND("ShCalc.SetIntNum16 %p:\n", var);
DEBUG_COMMAND("ShCalc.SetIntNum16 %p:", var);
}
static void SetIntNum32(void) { /* 2 */
int p1 = getCaliValue();
DEBUG_COMMAND_YET("ShCalc.SetIntNum32: %d:\n", p1);
DEBUG_COMMAND_YET("ShCalc.SetIntNum32: %d:", p1);
}
static void GetIntNum16(void) { /* 3 */
@@ -102,13 +102,13 @@ static void GetIntNum16(void) { /* 3 */
*var = i;
DEBUG_COMMAND("ShCalc.GetIntNum16 %d:\n", var);
DEBUG_COMMAND("ShCalc.GetIntNum16 %d:", var);
}
static void GetIntNum32(void) { /* 4 */
int p1 = getCaliValue();
DEBUG_COMMAND_YET("ShCalc.GetIntNum32: %d:\n", p1);
DEBUG_COMMAND_YET("ShCalc.GetIntNum32: %d:", p1);
}
static void AddIntNum16(void) { /* 5 */
@@ -121,25 +121,25 @@ static void AddIntNum16(void) { /* 5 */
l_1000A0D8 += mul64(*var, numbase);
DEBUG_COMMAND("ShCalc.AddIntNum16 %p:\n", var);
DEBUG_COMMAND("ShCalc.AddIntNum16 %p:", var);
}
static void AddIntNum32(void) { /* 6 */
int p1 = getCaliValue();
DEBUG_COMMAND_YET("ShCalc.AddIntNum32: %d:\n", p1);
DEBUG_COMMAND_YET("ShCalc.AddIntNum32: %d:", p1);
}
static void SubIntNum16(void) { /* 7 */
int p1 = getCaliValue();
DEBUG_COMMAND_YET("ShCalc.SubIntNum16: %d:\n", p1);
DEBUG_COMMAND_YET("ShCalc.SubIntNum16: %d:", p1);
}
static void SubIntNum32(void) { /* 8 */
int p1 = getCaliValue();
DEBUG_COMMAND_YET("ShCalc.SubIntNum32: %d:\n", p1);
DEBUG_COMMAND_YET("ShCalc.SubIntNum32: %d:", p1);
}
static void MulIntNum16(void) { /* 9 */
@@ -152,13 +152,13 @@ static void MulIntNum16(void) { /* 9 */
l_1000A0D8 *= mul64(*var, numbase);
DEBUG_COMMAND("ShCalc.MulIntNum16: %p:\n", var);
DEBUG_COMMAND("ShCalc.MulIntNum16: %p:", var);
}
static void MulIntNum32(void) { /* 10 */
int p1 = getCaliValue();
DEBUG_COMMAND_YET("ShCalc.MulIntNum32: %d:\n", p1);
DEBUG_COMMAND_YET("ShCalc.MulIntNum32: %d:", p1);
}
static void DivIntNum16(void) { /* 11 */
@@ -175,13 +175,13 @@ static void DivIntNum16(void) { /* 11 */
i = mul64(l_1000A0C8, numbase);
l_1000A0D8 = div64(l_1000A0D8, i);
DEBUG_COMMAND("ShCalc.DivIntNum16 %p:\n", var);
DEBUG_COMMAND("ShCalc.DivIntNum16 %p:", var);
}
static void DivIntNum32(void) { /* 12 */
int p1 = getCaliValue();
DEBUG_COMMAND_YET("ShCalc.DivIntNum32: %d:\n", p1);
DEBUG_COMMAND_YET("ShCalc.DivIntNum32: %d:", p1);
}
static void CmpIntNum16(void) { /* 13 */
@@ -189,7 +189,7 @@ static void CmpIntNum16(void) { /* 13 */
int p2 = getCaliValue();
int p3 = getCaliValue();
DEBUG_COMMAND_YET("ShCalc.CmpIntNum16: %d,%d,%d:\n", p1, p2, p3);
DEBUG_COMMAND_YET("ShCalc.CmpIntNum16: %d,%d,%d:", p1, p2, p3);
}
static void CmpIntNum32(void) { /* 14 */
@@ -197,7 +197,7 @@ static void CmpIntNum32(void) { /* 14 */
int p2 = getCaliValue();
int p3 = getCaliValue();
DEBUG_COMMAND_YET("ShCalc.CmpIntNum32: %d,%d,%d:\n", p1, p2, p3);
DEBUG_COMMAND_YET("ShCalc.CmpIntNum32: %d,%d,%d:", p1, p2, p3);
}
static void GetLengthNum16(void) { /* 15 */
@@ -221,14 +221,14 @@ static void GetLengthNum16(void) { /* 15 */
*vResult = 1;
}
DEBUG_COMMAND("ShCalc.GetLengthNum16 %p,%p:\n", var, vResult);
DEBUG_COMMAND("ShCalc.GetLengthNum16 %p,%p:", var, vResult);
}
static void GetLengthNum32(void) { /* 16 */
int p1 = getCaliValue();
int p2 = getCaliValue();
DEBUG_COMMAND_YET("ShCalc.GetLengthNum32: %d,%d:\n", p1, p2);
DEBUG_COMMAND_YET("ShCalc.GetLengthNum32: %d,%d:", p1, p2);
}
static void NumToRate(void) { /* 17 */
@@ -259,7 +259,7 @@ static void NumToRate(void) { /* 17 */
*vResult = i;
DEBUG_COMMAND("ShCalc.NumToRate %d,%d,%d,%d,%p:\n", p1, p2, p3, flag, vResult);
DEBUG_COMMAND("ShCalc.NumToRate %d,%d,%d,%d,%p:", p1, p2, p3, flag, vResult);
}
@@ -291,7 +291,7 @@ static void NumToRateNum(void) { /* 18 */
*vResult = i;
DEBUG_COMMAND("ShCalc.NumToRateNum %d,%d,%d,%d,%p:\n", p1, p2, p3, flag, vResult);
DEBUG_COMMAND("ShCalc.NumToRateNum %d,%d,%d,%d,%p:", p1, p2, p3, flag, vResult);
}
static void SetRandomSeed() {
@@ -304,7 +304,7 @@ static void SetRandomSeed() {
sgenrand(seed);
DEBUG_COMMAND("ShCalc.SetRandomSeed %d:\n", seed);
DEBUG_COMMAND("ShCalc.SetRandomSeed %d:", seed);
}
static void GetRandomNumA() {
@@ -317,7 +317,7 @@ static void GetRandomNumA() {
*var = (int)(genrand() * num) + 1;
}
DEBUG_COMMAND("ShCalc.GetRandomNumA %d,%p:\n", num, var);
DEBUG_COMMAND("ShCalc.GetRandomNumA %d,%p:", num, var);
}
static void NumToBit() {
@@ -339,7 +339,7 @@ static void NumToBit() {
*var = 0;
}
DEBUG_COMMAND("ShCalc.NumToBit %d,%p:\n", beki, var);
DEBUG_COMMAND("ShCalc.NumToBit %d,%p:", beki, var);
}
static void BitToNum() {
@@ -358,7 +358,7 @@ static void BitToNum() {
int *var = getCaliVariable();
int i;
DEBUG_COMMAND("ShCalc.BitToNum %d,%p:\n", val, var);
DEBUG_COMMAND("ShCalc.BitToNum %d,%p:", val, var);
if (val == 0) {
*var = 0;
+36 -32
View File
@@ -37,6 +37,7 @@
#include "ags.h"
#include "music.h"
#include "sdl_core.h"
#include "hacks.h"
#define SLOT 40
@@ -95,13 +96,13 @@ static void Init() {
*/
int p1 = getCaliValue(); /* ISurface */
DEBUG_COMMAND("ShGraph.Init %d:\n", p1);
DEBUG_COMMAND("ShGraph.Init %d:", p1);
}
static void GetSurfaceData() {
int p1 = getCaliValue(); /* ISurface */
DEBUG_COMMAND_YET("ShGraph.GetSurfaceData %d:\n", p1);
DEBUG_COMMAND_YET("ShGraph.GetSurfaceData %d:", p1);
}
static void ChangeEquColor() {
@@ -113,7 +114,7 @@ static void ChangeEquColor() {
int *p6 = getCaliVariable();
int p7 = getCaliValue(); /* ISurface */
DEBUG_COMMAND_YET("ShGraph.ChangeEquColor %d,%d,%d,%d,%p,%p,%d:\n", p1, p2, p3, p4, p5, p6, p7);
DEBUG_COMMAND_YET("ShGraph.ChangeEquColor %d,%d,%d,%d,%p,%p,%d:", p1, p2, p3, p4, p5, p6, p7);
}
static void ChangeNotColor() {
@@ -136,9 +137,9 @@ static void ChangeNotColor() {
int p7 = getCaliValue(); /* ISurface */
agsurface_t *dib;
int x, y;
BYTE *dp;
uint8_t *dp;
DEBUG_COMMAND("ShGraph.ChangeNotColor %d,%d,%d,%d,%p,%p,%d:\n", x0, y0, width, height, src, dst, p7);
DEBUG_COMMAND("ShGraph.ChangeNotColor %d,%d,%d,%d,%p,%p,%d:", x0, y0, width, height, src, dst, p7);
ags_check_param(&x0, &y0, &width, &height);
@@ -148,12 +149,12 @@ static void ChangeNotColor() {
switch(dib->depth) {
case 16:
{
WORD pic16s = PIX16(*src, *(src+1), *(src+2));
WORD pic16d = PIX16(*dst, *(dst+1), *(dst+2));
WORD *yl;
uint16_t pic16s = PIX16(*src, *(src+1), *(src+2));
uint16_t pic16d = PIX16(*dst, *(dst+1), *(dst+2));
uint16_t *yl;
for (y = 0; y < height; y++) {
yl = (WORD *)(dp + y * dib->bytes_per_line);
yl = (uint16_t *)(dp + y * dib->bytes_per_line);
for (x = 0; x < width; x++) {
if (*yl != pic16s) {
*yl = pic16d;
@@ -166,14 +167,14 @@ static void ChangeNotColor() {
case 24:
case 32:
{
DWORD pic24s = PIX24(*src, *(src+1), *(src+2)) & 0xf0f0f0;
DWORD pic24d = PIX24(*dst, *(dst+1), *(dst+2)) & 0xf0f0f0;
DWORD *yl;
uint32_t pic24s = PIX24(*src, *(src+1), *(src+2));
uint32_t pic24d = PIX24(*dst, *(dst+1), *(dst+2));
uint32_t *yl;
for (y = 0; y < height; y++) {
yl = (DWORD *)(dp + y * dib->bytes_per_line);
yl = (uint32_t *)(dp + y * dib->bytes_per_line);
for (x = 0; x < width; x++) {
if ((*yl & 0xf0f0f0) != pic24s) {
if (*yl != pic24s) {
*yl = pic24d;
}
yl++;
@@ -182,6 +183,9 @@ static void ChangeNotColor() {
break;
}
}
// The CX command after ChangeNotColor (in FIGHT.ADV) must use a precise
// calculation.
daiakuji_cx_hack = true;
}
/*
@@ -218,7 +222,7 @@ static void ResetAnimeData() {
*/
int no = getCaliValue();
DEBUG_COMMAND("ShGraph.ResetAnimeData %d:\n", no);
DEBUG_COMMAND("ShGraph.ResetAnimeData %d:", no);
if (no > 0 && no <= SLOT) {
memset(&src[no-1], 0, sizeof(struct animsrc));
@@ -258,7 +262,7 @@ static void SetAnimeSrc() {
int *pal = getCaliVariable();
int r, g, b;
DEBUG_COMMAND("ShGraph.SetAnimeSrc %d,%d,%d,%d,%d,%d,%d,%p:\n", no, x0, y0, w, h, uw, uh, pal);
DEBUG_COMMAND("ShGraph.SetAnimeSrc %d,%d,%d,%d,%d,%d,%d,%p:", no, x0, y0, w, h, uw, uh, pal);
if (no <= 0 || no > SLOT) return;
@@ -298,7 +302,7 @@ static void SetAnimeDst() {
int p5 = getCaliValue();
int p6 = getCaliValue();
DEBUG_COMMAND("ShGraph.SetAnimeDst %d,%p,%p,%d,%d,%d,%d:\n", no, p1, p2, p3, p4, p5, p6);
DEBUG_COMMAND("ShGraph.SetAnimeDst %d,%p,%p,%d,%d,%d,%d:", no, p1, p2, p3, p4, p5, p6);
if (no <= 0 || no > SLOT) return;
@@ -332,7 +336,7 @@ static void AddAnimeData() {
int p6 = getCaliValue();
int i;
DEBUG_COMMAND("ShGraph.AddAnimeData %d,%d,%d,%d,%p,%d:\n", no, p2, p3, p4, p5, p6);
DEBUG_COMMAND("ShGraph.AddAnimeData %d,%d,%d,%d,%p,%d:", no, p2, p3, p4, p5, p6);
if (no <= 0 || no > SLOT) return;
@@ -366,7 +370,7 @@ static void AddAnimeRemain() {
int no = getCaliValue();
int i, _max = 0;
DEBUG_COMMAND("ShGraph.AddAnimeRemain %d:\n", no);
DEBUG_COMMAND("ShGraph.AddAnimeRemain %d:", no);
if (no <= 0 || no > SLOT) return;
@@ -397,7 +401,7 @@ static void SetAnimeRect() {
int w = getCaliValue();
int h = getCaliValue();
DEBUG_COMMAND("ShGraph.SetAnimeRect %d,%d,%d,%d:\n", x, y, w, h);
DEBUG_COMMAND("ShGraph.SetAnimeRect %d,%d,%d,%d:", x, y, w, h);
maprect.x = x;
maprect.y = y;
@@ -423,7 +427,7 @@ static void SetAnimeBack() {
int p5 = getCaliValue();
int p6 = getCaliValue();
DEBUG_COMMAND("ShGraph.SetAnimeBack %d,%d,%d,%d,%d,%d:\n", sx, sy, w, h, p5, p6);
DEBUG_COMMAND("ShGraph.SetAnimeBack %d,%d,%d,%d,%d,%d:", sx, sy, w, h, p5, p6);
mapback.x = sx;
mapback.y = sy;
@@ -451,7 +455,7 @@ static void PlayAnimeData() {
boolean is_backcopied;
agsurface_t *dib;
DEBUG_COMMAND("ShGraph.PlayAnimeData %d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6);
DEBUG_COMMAND("ShGraph.PlayAnimeData %d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6);
interval = p2 * 10;
@@ -551,7 +555,7 @@ static void PlayAnimeData() {
static void copy_sprite(int sx, int sy, int width, int height, int dx, int dy, int r, int g, int b) {
int x, y;
BYTE *sp, *dp;
uint8_t *sp, *dp;
agsurface_t *dib;
if (dx < 0 || dy < 0) return;
@@ -567,12 +571,12 @@ static void copy_sprite(int sx, int sy, int width, int height, int dx, int dy, i
switch(dib->depth) {
case 16:
{
WORD pic16 = PIX16(r, g, b);
WORD *yls, *yld;
uint16_t pic16 = PIX16(r, g, b);
uint16_t *yls, *yld;
for (y = 0; y < height; y++) {
yls = (WORD *)(sp + y * dib->bytes_per_line);
yld = (WORD *)(dp + y * dib->bytes_per_line);
yls = (uint16_t *)(sp + y * dib->bytes_per_line);
yld = (uint16_t *)(dp + y * dib->bytes_per_line);
for (x = 0; x < width; x++) {
if (*yls != pic16) {
*yld = *yls;
@@ -585,14 +589,14 @@ static void copy_sprite(int sx, int sy, int width, int height, int dx, int dy, i
case 24:
case 32:
{
DWORD pic24 = PIX24(r, g, b) & 0xf0f0f0;
DWORD *yls, *yld;
uint32_t pic24 = PIX24(r, g, b);
uint32_t *yls, *yld;
for (y = 0; y < height; y++) {
yls = (DWORD *)(sp + y * dib->bytes_per_line);
yld = (DWORD *)(dp + y * dib->bytes_per_line);
yls = (uint32_t *)(sp + y * dib->bytes_per_line);
yld = (uint32_t *)(dp + y * dib->bytes_per_line);
for (x = 0; x < width; x++) {
if ((*yls & 0xf0f0f0) != pic24) {
if (*yls != pic24) {
*yld = *yls;
}
yls++; yld++;
+17 -16
View File
@@ -37,11 +37,12 @@
#include "modules.h"
#include "sdl_core.h"
#include "sdl_private.h"
#include "input.h"
#include "menu.h"
// キー変換テーブル
#define KEYMAP_MAX 8
static BYTE *keymap[KEYMAP_MAX];
static uint8_t *keymap[KEYMAP_MAX];
static void OutputMessageBox(void) { /* 0 */
int p1 = getCaliValue();
@@ -59,7 +60,7 @@ static void OutputMessageBox(void) { /* 0 */
free(title_utf8);
free(msg_utf8);
DEBUG_COMMAND("ShPort.OutputMessageBox: %d,%d,%d,%d,%p,%d:\n", p1, p2, title, msg, res, ISys3xSystem);
DEBUG_COMMAND("ShPort.OutputMessageBox: %d,%d,%d,%d,%p,%d:", p1, p2, title, msg, res, ISys3xSystem);
}
static void InputListNum(void) { /* 1 */
@@ -82,12 +83,12 @@ static void InputListNum(void) { /* 1 */
if (ni_param.value < 0) {
*res = 0;
} else {
*val = (WORD)ni_param.value;
*val = (uint16_t)ni_param.value;
*res = 1;
}
free(ni_param.title);
DEBUG_COMMAND("ShPort.InputListNum: %d,%d,%p,%d,%d,%p,%d:\n", flags, title, val, minval, maxval, res, ISys3xSystem);
DEBUG_COMMAND("ShPort.InputListNum: %d,%d,%p,%d,%d,%p,%d:", flags, title, val, minval, maxval, res, ISys3xSystem);
}
/**
@@ -98,7 +99,7 @@ static void InputListNum(void) { /* 1 */
static void Init(void) {
int p1 = getCaliValue();
DEBUG_COMMAND_YET("ShPort.Init: %d:\n", p1);
DEBUG_COMMAND_YET("ShPort.Init: %d:", p1);
}
/**
@@ -110,17 +111,17 @@ static void InitKeyStatus(void) {
int no = getCaliValue();
if (no >= KEYMAP_MAX) {
WARNING("Overflow keymap table(p1)\n", no);
WARNING("Overflow keymap table(p1)", no);
return;
}
if (keymap[no -1] == NULL) {
keymap[no -1] = calloc(256, sizeof(BYTE));
keymap[no -1] = calloc(256, sizeof(uint8_t));
} else {
memset(keymap[no -1], 0, 256);
}
DEBUG_COMMAND("ShPort.InitKeyStatus: %d:\n", no);
DEBUG_COMMAND("ShPort.InitKeyStatus: %d:", no);
}
/**
@@ -136,13 +137,13 @@ static void SetKeyStatus(void) {
int func = getCaliValue();
if (no >= KEYMAP_MAX) {
WARNING("Overflow keymap table(p1)\n", no);
WARNING("Overflow keymap table(p1)", no);
return;
}
keymap[no -1][key] = func;
DEBUG_COMMAND("ShPort.SetKeyStatus: %d,%d,%d:\n", no, key, func);
DEBUG_COMMAND("ShPort.SetKeyStatus: %d,%d,%d:", no, key, func);
}
/**
@@ -157,16 +158,16 @@ static void GetKeyStatus(void) {
int i;
if (no >= KEYMAP_MAX) {
WARNING("Overflow keymap table(p1)\n", no);
WARNING("Overflow keymap table(p1)", no);
return;
}
*var = 0;
for (i = 0; i < 256; i++) {
for (i = 0; i < NUM_KEYCODES; i++) {
*var |= (keymap[no -1][i] * RawKeyInfo[i]);
}
DEBUG_COMMAND("ShPort.GetKeyStatus: %d,%p:\n", no, var);
DEBUG_COMMAND("ShPort.GetKeyStatus: %d,%p:", no, var);
}
static void InputListString(void) {
@@ -178,7 +179,7 @@ static void InputListString(void) {
int p6 = getCaliValue();
int p7 = getCaliValue();
DEBUG_COMMAND_YET("ShPort.InputListString: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p3, p4, p5, p6, p7);
DEBUG_COMMAND_YET("ShPort.InputListString: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p3, p4, p5, p6, p7);
}
static void InputOpenFile(void) {
@@ -190,7 +191,7 @@ static void InputOpenFile(void) {
int p6 = getCaliValue();
int p7 = getCaliValue();
DEBUG_COMMAND_YET("ShPort.InputOpenFile: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p3, p4, p5, p6, p7);
DEBUG_COMMAND_YET("ShPort.InputOpenFile: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p3, p4, p5, p6, p7);
}
static void InputSaveFile(void) {
@@ -202,7 +203,7 @@ static void InputSaveFile(void) {
int p6 = getCaliValue();
int p7 = getCaliValue();
DEBUG_COMMAND_YET("ShPort.InputSaveFile: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p3, p4, p5, p6, p7);
DEBUG_COMMAND_YET("ShPort.InputSaveFile: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p3, p4, p5, p6, p7);
}
static const ModuleFunc functions[] = {
+105 -38
View File
@@ -26,8 +26,10 @@
#include <stdio.h>
#include <string.h>
#include <SDL.h>
#include "portab.h"
#include "LittleEndian.h"
#include "xsystem35.h"
#include "modules.h"
#include "nact.h"
@@ -35,12 +37,16 @@
#include "ald_manager.h"
#include "music.h"
#ifdef ENABLE_SDLMIXER
#include "pcm.sdlmixer.h"
#include "shpcmlib.c"
static struct {
SDL_AudioSpec spec; // must be 16-bit, stereo
uint8_t *buf;
uint32_t len;
} memwav;
static Mix_Chunk *chunk;
#endif
static void free_memory_wav(void) {
SDL_FreeWAV(memwav.buf);
memwav.buf = NULL;
}
static void Init() {
/*
@@ -48,7 +54,7 @@ static void Init() {
*/
int p1 = getCaliValue(); /* ISys3x */
DEBUG_COMMAND("ShSound.Init %d:\n", p1);
DEBUG_COMMAND("ShSound.Init %d:", p1);
}
static void wavLoad() {
@@ -61,7 +67,7 @@ static void wavLoad() {
int slot = getCaliValue();
int no = getCaliValue();
DEBUG_COMMAND("ShSound.wavLoad %d,%d:\n", slot, no);
DEBUG_COMMAND("ShSound.wavLoad %d,%d:", slot, no);
mus_wav_load(slot, no);
}
@@ -76,7 +82,7 @@ static void wavUnload() {
mus_wav_unload(slot);
DEBUG_COMMAND("ShSound.wavUnload %d:\n",slot);
DEBUG_COMMAND("ShSound.wavUnload %d:",slot);
}
static void wavUnloadRange() {
@@ -94,7 +100,7 @@ static void wavUnloadRange() {
mus_wav_unload(i);
}
DEBUG_COMMAND("ShSound.wavUnloadRange %d,%d:\n", slot, range);
DEBUG_COMMAND("ShSound.wavUnloadRange %d,%d:", slot, range);
}
static void wavUnloadAll() {
@@ -107,7 +113,7 @@ static void wavUnloadAll() {
mus_wav_unload(i);
}
DEBUG_COMMAND("ShSound.wavUnloadAll:\n");
DEBUG_COMMAND("ShSound.wavUnloadAll:");
}
static void wavLoadMemory() {
@@ -117,12 +123,26 @@ static void wavLoadMemory() {
no:
*/
int no = getCaliValue();
if (memwav.buf)
free_memory_wav();
dridata *dfile = ald_getdata(DRIFILE_WAVE, no - 1);
if (!dfile) {
WARNING("cannot open WAVE %d", no - 1);
return;
}
if (!SDL_LoadWAV_RW(SDL_RWFromConstMem(dfile->data, dfile->size), 1, &memwav.spec, &memwav.buf, &memwav.len)) {
WARNING("cannot load WAVE %d", no - 1);
return;
}
if (memwav.spec.channels != 2 || memwav.spec.format != AUDIO_S16LSB) {
WARNING("unexpected audio format");
free_memory_wav();
return;
}
#ifdef ENABLE_SDLMIXER
chunk = pcm_sdlmixer_load(no);
#endif
DEBUG_COMMAND("ShSound.wavLoadMemory %d:\n", no);
DEBUG_COMMAND("ShSound.wavLoadMemory %d:", no);
}
static void wavSendMemory() {
@@ -133,14 +153,40 @@ static void wavSendMemory() {
*/
int slot = getCaliValue();
#ifdef ENABLE_SDLMIXER
if (chunk) {
pcm_sdlmixer_load_chunk(slot, chunk);
chunk = NULL;
if (!memwav.buf) {
WARNING("wave not loaded");
return;
}
#endif
const uint8_t wave_header[] = {
'R', 'I', 'F', 'F',
0, 0, 0, 0, // filesize - 8 (filled later)
'W', 'A', 'V', 'E',
'f', 'm', 't', ' ',
16, 0, 0, 0, // size of fmt chunk
1, 0, // PCM format
2, 0, // stereo
0, 0, 0, 0, // sampling rate (filled later)
0, 0, 0, 0, // bytes / sec (filled later)
4, 0, // block size
16, 0, // bits / sample
'd', 'a', 't', 'a',
0, 0, 0, 0, // size of data chunk (filled later)
};
uint32_t wav_size = sizeof(wave_header) + memwav.len;
uint8_t *wav_buf = malloc(wav_size);
memcpy(wav_buf, wave_header, sizeof(wave_header));
LittleEndian_putDW(wav_size - 8, wav_buf, 4);
LittleEndian_putDW(memwav.spec.freq, wav_buf, 24);
LittleEndian_putDW(memwav.spec.freq * 4, wav_buf, 28);
LittleEndian_putDW(memwav.len, wav_buf, 40);
memcpy(wav_buf + sizeof(wave_header), memwav.buf, memwav.len);
mus_wav_load_data(slot, wav_buf, wav_size);
free_memory_wav();
free(wav_buf);
DEBUG_COMMAND("ShSound.wavSendMemory %d:\n", slot);
DEBUG_COMMAND("ShSound.wavSendMemory %d:", slot);
}
static void wavFadeVolumeMemory() {
@@ -153,13 +199,28 @@ static void wavFadeVolumeMemory() {
int start = getCaliValue();
int range = getCaliValue();
#ifdef ENABLE_SDLMIXER
if (chunk == NULL) return;
if (!memwav.buf)
return;
pcmlib_fade_volume_memory(chunk, start, range);
#endif
start *= memwav.spec.freq / 100; // 10ms -> sample
range *= memwav.spec.freq / 100; // 10ms -> sample
if (memwav.len / 4 < start + range)
return;
int16_t *buf = (int16_t*)memwav.buf + start * 2;
// 指定の場所から徐々に音量を下げる
for (int i = range; i > 0; i--) {
buf[0] = buf[0] * i / range;
buf[1] = buf[1] * i / range;
buf += 2;
}
// 残りは無音
memset(buf, 0, memwav.buf + memwav.len - (uint8_t*)buf);
DEBUG_COMMAND("ShSound.wavFadeVolumeMemory %d,%d:\n", start, range);
DEBUG_COMMAND("ShSound.wavFadeVolumeMemory %d,%d:", start, range);
}
static void wavReversePanMemory() {
@@ -167,13 +228,19 @@ static void wavReversePanMemory() {
wavLoadMemoryで読み込んだデータの左右のチャンネルを反転
*/
#ifdef ENABLE_SDLMIXER
if (chunk == NULL) return;
if (!memwav.buf)
return;
pcmlib_reverse_pan_memory(chunk);
#endif
int16_t *buf = (int16_t*)memwav.buf;
int len = memwav.len / 4;
for (int i = 0; i < len; i++) {
int16_t tmp = buf[0];
buf[0] = buf[1];
buf[1] = tmp;
buf += 2;
}
DEBUG_COMMAND("ShSound.wavReversePanMemory:\n");
DEBUG_COMMAND("ShSound.wavReversePanMemory:");
}
static void wavPlay() {
@@ -188,7 +255,7 @@ static void wavPlay() {
mus_wav_play(slot, loop == 0 ? 1 : -1);
DEBUG_COMMAND("ShSound.wavPlay %d, %d:\n", slot, loop);
DEBUG_COMMAND("ShSound.wavPlay %d, %d:", slot, loop);
}
static void wavPlayRing() {
@@ -206,7 +273,7 @@ static void wavPlayRing() {
mus_wav_play(start + (*cur % cnt), 1);
*cur = (*cur + 1) % cnt;
DEBUG_COMMAND("ShSound.wavPlayRing %d,%d,%d:\n", start, cnt, *cur);
DEBUG_COMMAND("ShSound.wavPlayRing %d,%d,%d:", start, cnt, *cur);
}
static void wavStop() {
@@ -217,7 +284,7 @@ static void wavStop() {
*/
int slot = getCaliValue();
DEBUG_COMMAND("ShSound.wavStop %d:\n", slot);
DEBUG_COMMAND("ShSound.wavStop %d:", slot);
mus_wav_stop(slot);
}
@@ -232,7 +299,7 @@ static void wavStopAll() {
mus_wav_stop(i);
}
DEBUG_COMMAND("ShSound.wavStopAll:\n");
DEBUG_COMMAND("ShSound.wavStopAll:");
}
static void wavPause() {
@@ -243,7 +310,7 @@ static void wavPause() {
*/
int slot = getCaliValue();
DEBUG_COMMAND_YET("ShSound.wavPause %d:\n", slot);
DEBUG_COMMAND_YET("ShSound.wavPause %d:", slot);
}
static void wavIsPlay() {
@@ -258,7 +325,7 @@ static void wavIsPlay() {
*result = mus_wav_get_playposition(slot);
DEBUG_COMMAND("ShSound.wavIsPlay %d,%p:\n", slot, result);
DEBUG_COMMAND("ShSound.wavIsPlay %d,%p:", slot, result);
}
static void wavIsPlayRange() {
@@ -280,7 +347,7 @@ static void wavIsPlayRange() {
*result = ret;
DEBUG_COMMAND("ShSound.wavIsPlayRange %d,%d,%p:\n", slot, range, result);
DEBUG_COMMAND("ShSound.wavIsPlayRange %d,%d,%p:", slot, range, result);
}
static const ModuleFunc functions[] = {
-70
View File
@@ -1,70 +0,0 @@
/*
* shpcmlib.c ShSound用 pcmlib
*
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
* 1998- <masaki-c@is.aist-nara.ac.jp>
*
* 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
*
*/
/* $Id: shpcmlib.c,v 1.2 2003/08/02 13:10:32 chikama Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <SDL_mixer.h>
#include "portab.h"
/*
*/
void pcmlib_reverse_pan_memory(Mix_Chunk *chunk) {
if (chunk == NULL) return;
short *buf = (short*)chunk->abuf;
int len = chunk->alen / 4;
for (int i = 0; i < len; i++) {
short tmp = buf[0];
buf[0] = buf[1];
buf[1] = tmp;
buf += 2;
}
}
/*
PCM
*/
void pcmlib_fade_volume_memory(Mix_Chunk *chunk, int start, int range) {
if (chunk == NULL) return;
start *= 441; // 10ms -> sample
range *= 441; // 10ms -> sample
if (chunk->alen / 4 < start + range)
return;
short *buf = (short*)chunk->abuf;
buf += start * 2;
// 指定の場所から徐々に音量を下げる
for (int i = range; i > 0; i--) {
buf[0] = buf[0] * i / range;
buf[1] = buf[1] * i / range;
buf += 2;
}
// 残りは無音
memset(buf, 0, chunk->abuf + chunk->alen - (Uint8*)buf);
}
+13 -11
View File
@@ -46,35 +46,35 @@ static void ExchangeString(void) {
int pat = getCaliValue();
int patr = getCaliValue();
svar_replaceAll(target, pat, patr);
DEBUG_COMMAND("ShString.ExchangeString: %d,%d,%d:\n", target, pat, patr);
DEBUG_COMMAND("ShString.ExchangeString: %d,%d,%d:", target, pat, patr);
}
static void SetNum16String(void) { /* 1 */
int p1 = getCaliValue();
int p2 = getCaliValue();
DEBUG_COMMAND_YET("ShString.SetNum16String: %d,%d:\n", p1, p2);
DEBUG_COMMAND_YET("ShString.SetNum16String: %d,%d:", p1, p2);
}
static void SetNum16HalfString(void) { /* 2 */
int p1 = getCaliValue();
int p2 = getCaliValue();
DEBUG_COMMAND_YET("ShString.SetNum16HalfString: %d,%d:\n", p1, p2);
DEBUG_COMMAND_YET("ShString.SetNum16HalfString: %d,%d:", p1, p2);
}
static void SetNum32String(void) { /* 3 */
int p1 = getCaliValue();
int p2 = getCaliValue();
DEBUG_COMMAND_YET("ShString.SetNum32String: %d,%d:\n", p1, p2);
DEBUG_COMMAND_YET("ShString.SetNum32String: %d,%d:", p1, p2);
}
static void SetNum32HalfString(void) { /* 4 */
int p1 = getCaliValue();
int p2 = getCaliValue();
DEBUG_COMMAND_YET("ShString.SetNum32HalfString: %d,%d:\n", p1, p2);
DEBUG_COMMAND_YET("ShString.SetNum32HalfString: %d,%d:", p1, p2);
}
static void GetArrayString(void) { /* 5 */
@@ -82,16 +82,18 @@ static void GetArrayString(void) { /* 5 */
int p2 = getCaliValue();
int p3 = getCaliValue();
DEBUG_COMMAND_YET("ShString.GetArrayString: %d,%d,%d:\n", p1, p2, p3);
DEBUG_COMMAND_YET("ShString.GetArrayString: %d,%d,%d:", p1, p2, p3);
}
static void SetWindowTitle(void) { /* 6 */
int strno = getCaliValue();
int p2 = getCaliValue(); /* ISys3xSystem */
ags_setWindowTitle(svar_get(strno));
char *title_utf8 = toUTF8(svar_get(strno));
ags_setWindowTitle(title_utf8);
free(title_utf8);
DEBUG_COMMAND("ShString.SetWindowTitle: %d,%d:\n", strno, p2);
DEBUG_COMMAND("ShString.SetWindowTitle: %d,%d:", strno, p2);
}
static void FillString() {
@@ -113,7 +115,7 @@ static void FillString() {
svar_set(st + i, svar_get(src));
}
DEBUG_COMMAND("ShString.FillString: %d,%d,%d,%d:\n", st, cnt, src, p4);
DEBUG_COMMAND("ShString.FillString: %d,%d,%d,%d:", st, cnt, src, p4);
}
static void SetStringNum16(void) {
@@ -130,7 +132,7 @@ static void SetStringNum16(void) {
char _dst[100];
char *dst = _dst;
DEBUG_COMMAND("ShString.SetStringNum16: %d,%p:\n", st, var);
DEBUG_COMMAND("ShString.SetStringNum16: %d,%p:", st, var);
while(*str) {
@@ -160,7 +162,7 @@ static void SetStringNum32(void) {
int p1 = getCaliValue();
int *p2 = getCaliVariable();
DEBUG_COMMAND_YET("ShString.SetStringNum32: %d,%p:\n", p1, p2);
DEBUG_COMMAND_YET("ShString.SetStringNum32: %d,%p:", p1, p2);
}
static const ModuleFunc functions[] = {
+6 -6
View File
@@ -29,34 +29,34 @@ static void Init() {
dd.alk = alk_new("/home/masaki-c/game/daiakuji/dDemo.alk");
#endif
DEBUG_COMMAND_YET("dDemo.Init %d,%d,%d,%p:\n", p1, p2, p3, var);
DEBUG_COMMAND_YET("dDemo.Init %d,%d,%d,%p:", p1, p2, p3, var);
}
static void SetKeyCancelFlag() {
int cancelflag = getCaliValue();
DEBUG_COMMAND_YET("dDemo.SetKeyCancelFlag %d:\n", cancelflag);
DEBUG_COMMAND_YET("dDemo.SetKeyCancelFlag %d:", cancelflag);
}
static void SetLoopFlag() {
/* Loop Flag */
int loopflag = getCaliValue(); /* 0 なら無限繰り返し */
DEBUG_COMMAND_YET("dDemo.SetLoopFlag %d:\n", loopflag);
DEBUG_COMMAND_YET("dDemo.SetLoopFlag %d:", loopflag);
}
static void Run() {
DEBUG_COMMAND_YET("dDemo.Run:\n");
DEBUG_COMMAND_YET("dDemo.Run:");
#ifdef DDEMODEV
mus_cdrom_start(13, 1);
muscd_start(13, 1);
// ddemo_scene();
while(0 == sys_getInputInfo()) {
usleep(1000 * 100);
}
mus_cdrom_stop();
muscd_stop();
#endif
}
+5 -5
View File
@@ -17,31 +17,31 @@ static void Init() {
*var = 1;
DEBUG_COMMAND_YET("eDEMO.Init %d,%d,%d,%p:\n", p1, p2, p3, var);
DEBUG_COMMAND_YET("eDEMO.Init %d,%d,%d,%p:", p1, p2, p3, var);
}
static void SetKeyCancelFlag() {
int cancelflag = getCaliValue();
DEBUG_COMMAND_YET("eDEMO.SetKeyCancelFlag %d:\n", cancelflag);
DEBUG_COMMAND_YET("eDEMO.SetKeyCancelFlag %d:", cancelflag);
}
static void SetLoopFlag() {
/* Loop Flag */
int loopflag = getCaliValue(); /* 0 なら無限繰り返し */
DEBUG_COMMAND_YET("eDEMO.SetLoopFlag %d:\n", loopflag);
DEBUG_COMMAND_YET("eDEMO.SetLoopFlag %d:", loopflag);
}
static void SetDrawStaffFlag() {
/* Loop Flag */
int staffflag = getCaliValue();
DEBUG_COMMAND_YET("eDEMO.SetDrawStaffFlag %d:\n", staffflag);
DEBUG_COMMAND_YET("eDEMO.SetDrawStaffFlag %d:", staffflag);
}
static void Run() {
DEBUG_COMMAND_YET("eDEMO.Run:\n");
DEBUG_COMMAND_YET("eDEMO.Run:");
}
static const ModuleFunc functions[] = {
+4 -4
View File
@@ -17,26 +17,26 @@ static void Init() {
*var = 1;
DEBUG_COMMAND_YET("eeDEMO.Init %d,%d,%d,%p:\n", p1, p2, p3, var);
DEBUG_COMMAND_YET("eeDEMO.Init %d,%d,%d,%p:", p1, p2, p3, var);
}
static void SetKeyCancelFlag() {
int cancelflag = getCaliValue();
DEBUG_COMMAND_YET("eeDEMO.SetKeyCancelFlag %d:\n", cancelflag);
DEBUG_COMMAND_YET("eeDEMO.SetKeyCancelFlag %d:", cancelflag);
}
static void SetLoopFlag() {
/* Loop Flag */
int loopflag = getCaliValue(); /* 0 なら無限繰り返し */
DEBUG_COMMAND_YET("eeDEMO.SetLoopFlag %d:\n", loopflag);
DEBUG_COMMAND_YET("eeDEMO.SetLoopFlag %d:", loopflag);
}
static void Run() {
int p1 = getCaliValue();
DEBUG_COMMAND_YET("eeDEMO.Run %d:\n", p1);
DEBUG_COMMAND_YET("eeDEMO.Run %d:", p1);
}
static const ModuleFunc functions[] = {
+1 -1
View File
@@ -37,7 +37,7 @@ alk_t *alk_new(const char *path) {
mmap_t *m = map_file(path);
if (0 != strncmp(m->addr, "ALK0", 4)) {
WARNING("%s: not an ALK file\n", path);
WARNING("%s: not an ALK file", path);
unmap_file(m);
return NULL;
}
+2 -2
View File
@@ -46,7 +46,7 @@
* @param data:
* @return CGの種類(QNT/PMS8/PMS16のいずれか)
*/
static CG_TYPE check_cgformat(BYTE *data) {
static CG_TYPE check_cgformat(uint8_t *data) {
if (qnt_checkfmt(data)) {
return ALCG_QNT;
} else if (pms256_checkfmt(data)) {
@@ -94,7 +94,7 @@ surface_t *sf_getcg(void *b, size_t size) {
}
if (cg == NULL) {
WARNING("Unknown Cg Type\n");
WARNING("Unknown Cg Type");
return NULL;
}
+30 -30
View File
@@ -45,38 +45,38 @@ boolean gr_clip(surface_t *ss, int *sx, int *sy, int *sw, int *sh, surface_t *ds
int w, h;
if (ss == NULL) {
WARNING("ss surface is null\n");
WARNING("ss surface is null");
return FALSE;
}
if (ss == NULL) {
WARNING("ss surface is null\n");
WARNING("ss surface is null");
return FALSE;
}
if (*sx > ss->width) {
WARNING("sx is too large (sx=%d,width=%d)\n", *sx, ss->width);
WARNING("sx is too large (sx=%d,width=%d)", *sx, ss->width);
return FALSE;
}
if (*sy > ss->height) {
WARNING("sy is too large (sy=%d,height=%d)\n", *sy, ss->height);
WARNING("sy is too large (sy=%d,height=%d)", *sy, ss->height);
return FALSE;
}
if (*sx < 0) {
WARNING("sx is too small (sx=%d)\n", *sx);
WARNING("sx is too small (sx=%d)", *sx);
return FALSE;
}
if (*sy < 0) {
WARNING("sy is too small (sy=%d)\n", *sy);
WARNING("sy is too small (sy=%d)", *sy);
return FALSE;
}
if (*dx > ds->width) {
WARNING("dx is too large (dx=%d,width=%d)\n", *dx, ds->width);
WARNING("dx is too large (dx=%d,width=%d)", *dx, ds->width);
return FALSE;
}
if (*dy > ds->height) {
WARNING("dy is too large (dy=%d,height=%d)\n", *dy, ds->height);
WARNING("dy is too large (dy=%d,height=%d)", *dy, ds->height);
return FALSE;
}
@@ -94,19 +94,19 @@ boolean gr_clip(surface_t *ss, int *sx, int *sy, int *sw, int *sh, surface_t *ds
*sh = min(ss->height - *sy, min(ds->height - *dy, *sh));
if (*sw <= 0) {
WARNING("sw become <=0\n");
WARNING("sw become <=0");
return FALSE;
}
if (*sh <= 0) {
WARNING("sh become <=0\n");
WARNING("sh become <=0");
return FALSE;
}
if (*sw != w) {
NOTICE("width change %d -> %d\n", w, *sw);
NOTICE("width change %d -> %d", w, *sw);
}
if (*sh != h) {
NOTICE("height change %d -> %d\n", h, *sh);
NOTICE("height change %d -> %d", h, *sh);
}
return TRUE;
@@ -129,16 +129,16 @@ boolean gr_clip_xywh(surface_t *ss, int *sx, int *sy, int *sw, int *sh) {
int w, h;
if (ss == NULL) {
WARNING("ss surface is null\n");
WARNING("ss surface is null");
return FALSE;
}
if (*sx > ss->width) {
WARNING("sx is too large (sx=%d,width=%d)\n", *sx, ss->width);
WARNING("sx is too large (sx=%d,width=%d)", *sx, ss->width);
return FALSE;
}
if (*sy > ss->height) {
WARNING("sy is too large (sy=%d,height=%d)\n", *sy, ss->height);
WARNING("sy is too large (sy=%d,height=%d)", *sy, ss->height);
return FALSE;
}
@@ -156,19 +156,19 @@ boolean gr_clip_xywh(surface_t *ss, int *sx, int *sy, int *sw, int *sh) {
*sh = min(ss->height - *sy, *sh);
if (*sw <= 0) {
WARNING("sw become <=0\n");
WARNING("sw become <=0");
return FALSE;
}
if (*sh <= 0) {
WARNING("sh become <=0\n");
WARNING("sh become <=0");
return FALSE;
}
if (*sw != w) {
NOTICE("width change %d -> %d\n", w, *sw);
NOTICE("width change %d -> %d", w, *sw);
}
if (*sh != h) {
NOTICE("height change %d -> %d\n", h, *sh);
NOTICE("height change %d -> %d", h, *sh);
}
return TRUE;
@@ -246,7 +246,7 @@ void gr_copy_stretch_blend_alpha_map(surface_t *dst, int dx, int dy, int dw, int
float a1, a2, xd, yd;
int *row, *col;
int x, y;
BYTE *sp, *dp, *sa;
uint8_t *sp, *dp, *sa;
if (!gr_clip_xywh(dst, &dx, &dy, &dw, &dh)) return;
if (!gr_clip_xywh(src, &sx, &sy, &sw, &sh)) return;
@@ -274,13 +274,13 @@ void gr_copy_stretch_blend_alpha_map(surface_t *dst, int dx, int dy, int dw, int
switch(dst->depth) {
case 16:
{
WORD *yls, *yld;
BYTE *yla;
uint16_t *yls, *yld;
uint8_t *yla;
for (y = 0; y < dh; y++) {
yls = (WORD *)(sp + *(y + col) * src->bytes_per_line);
yld = (WORD *)(dp + y * dst->bytes_per_line);
yla = (BYTE *)(sa + *(y + col) * src->width);
yls = (uint16_t *)(sp + *(y + col) * src->bytes_per_line);
yld = (uint16_t *)(dp + y * dst->bytes_per_line);
yla = (uint8_t *)(sa + *(y + col) * src->width);
for (x = 0; x < dw; x++) {
*(yld + x) = ALPHABLEND16(*(yls+ *(row + x)), *(yld+x), *(yla+*(row+x)));
}
@@ -297,13 +297,13 @@ void gr_copy_stretch_blend_alpha_map(surface_t *dst, int dx, int dy, int dw, int
case 24:
case 32:
{
DWORD *yls, *yld;
BYTE *yla;
uint32_t *yls, *yld;
uint8_t *yla;
for (y = 0; y < dh; y++) {
yls = (DWORD *)(sp + *(y + col) * src->bytes_per_line);
yld = (DWORD *)(dp + y * dst->bytes_per_line);
yla = (BYTE *)(sa + *(y + col) * src->width);
yls = (uint32_t *)(sp + *(y + col) * src->bytes_per_line);
yld = (uint32_t *)(dp + y * dst->bytes_per_line);
yla = (uint8_t *)(sa + *(y + col) * src->width);
for (x = 0; x < dw; x++) {
*(yld + x) = ALPHABLEND24(*(yls+ *(row + x)), *(yld+x), *(yla+*(row+x)));
}
+18 -18
View File
@@ -1,5 +1,5 @@
void gr_fill_alpha_overborder(surface_t *dst, int dx, int dy, int dw, int dh, int s, int d) {
BYTE *dp;
uint8_t *dp;
int x, y;
if (dst == NULL) return;
@@ -10,14 +10,14 @@ void gr_fill_alpha_overborder(surface_t *dst, int dx, int dy, int dw, int dh, in
for (y = 0; y < dh; y++) {
for (x = 0; x < dw; x++) {
if (*(dp + x) >= (BYTE)s) *(dp + x) = (BYTE)d;
if (*(dp + x) >= (uint8_t)s) *(dp + x) = (uint8_t)d;
}
dp += dst->width;
}
}
void gr_fill_alpha_underborder(surface_t *dst, int dx, int dy, int dw, int dh, int s, int d) {
BYTE *dp;
uint8_t *dp;
int x, y;
if (dst == NULL) return;
@@ -28,14 +28,14 @@ void gr_fill_alpha_underborder(surface_t *dst, int dx, int dy, int dw, int dh, i
for (y = 0; y < dh; y++) {
for (x = 0; x < dw; x++) {
if (*(dp + x) <= (BYTE)s) *(dp + x) = (BYTE)d;
if (*(dp + x) <= (uint8_t)s) *(dp + x) = (uint8_t)d;
}
dp += dst->width;
}
}
void gr_copy_alpha_map_sprite(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int sw, int sh, int cl) {
BYTE *sp, *dp;
uint8_t *sp, *dp;
int x, y;
if (!gr_clip(src, &sx, &sy, &sw, &sh, dst, &dx, &dy)) return;
@@ -86,7 +86,7 @@ void gr_blend_alpha_wds_stretch2x2(surface_t *src1, int sx1, int sy1, surface_t
void gr_blend_alpha_wds(surface_t *src1, int sx1, int sy1, surface_t *src2, int sx2, int sy2, int sw, int sh, surface_t *dst, int dx, int dy) {
int x, y;
BYTE *sp1, *sp2, *dp, *sa;
uint8_t *sp1, *sp2, *dp, *sa;
sp1 = GETOFFSET_PIXEL(src1, sx1, sy1);
sp2 = GETOFFSET_PIXEL(src2, sx2, sy2);
@@ -96,14 +96,14 @@ void gr_blend_alpha_wds(surface_t *src1, int sx1, int sy1, surface_t *src2, int
switch(dst->depth) {
case 16:
{
WORD *yls1, *yls2, *yld;
BYTE *yla;
uint16_t *yls1, *yls2, *yld;
uint8_t *yla;
for (y = 0; y < sh; y++) {
yls1 = (WORD *)(sp1 + y * src1->bytes_per_line);
yls2 = (WORD *)(sp2 + y * src2->bytes_per_line);
yld = (WORD *)(dp + y * dst->bytes_per_line);
yla = (BYTE *)(sa + y * src1->width);
yls1 = (uint16_t *)(sp1 + y * src1->bytes_per_line);
yls2 = (uint16_t *)(sp2 + y * src2->bytes_per_line);
yld = (uint16_t *)(dp + y * dst->bytes_per_line);
yla = (uint8_t *)(sa + y * src1->width);
for (x = 0; x < sw; x++) {
*yld = SUTURADD16(*yls1, ALPHABLEND16(*yls1, *yls2, *yla));
@@ -116,14 +116,14 @@ void gr_blend_alpha_wds(surface_t *src1, int sx1, int sy1, surface_t *src2, int
case 24:
case 32:
{
DWORD *yls1, *yls2, *yld;
BYTE *yla;
uint32_t *yls1, *yls2, *yld;
uint8_t *yla;
for (y = 0; y < sh; y++) {
yls1 = (DWORD *)(sp1 + y * src1->bytes_per_line);
yls2 = (DWORD *)(sp2 + y * src2->bytes_per_line);
yld = (DWORD *)(dp + y * dst->bytes_per_line);
yla = (BYTE *)(sa + y * src1->width);
yls1 = (uint32_t *)(sp1 + y * src1->bytes_per_line);
yls2 = (uint32_t *)(sp2 + y * src2->bytes_per_line);
yld = (uint32_t *)(dp + y * dst->bytes_per_line);
yla = (uint8_t *)(sa + y * src1->width);
for (x = 0; x < sw; x++) {
*yld = SUTURADD24(*yls1, ALPHABLEND24(*yls1, *yls2, *yla));
+1 -1
View File
@@ -14,7 +14,7 @@ int gr_blend_alpha_map(surface_t *dst, int dx, int dy, surface_t *src, int sx, i
if (!gr_clip(src, &sx, &sy, &sw, &sh, dst, &dx, &dy)) return NG;
if (src->alpha == NULL) {
WARNING("src alpha NULL\n");
WARNING("src alpha NULL");
return NG;
}
+12 -12
View File
@@ -42,7 +42,7 @@
*/
void gr_drawimage24(surface_t *ds, cgdata *cg, int x, int y) {
int dx, dy, dw, dh;
BYTE *sp, *dp, r, g, b;
uint8_t *sp, *dp, r, g, b;
dx = x;
dy = y;
@@ -53,16 +53,16 @@ void gr_drawimage24(surface_t *ds, cgdata *cg, int x, int y) {
int data_offset = (abs(dy - y) * cg->width + abs(dx - x)) * 3;
sp = (BYTE *)(cg->pic + data_offset);
sp = (uint8_t *)(cg->pic + data_offset);
dp = GETOFFSET_PIXEL(ds, dx, dy);
switch(ds->depth) {
case 16:
{
WORD *yl;
uint16_t *yl;
for (y = 0; y < dh; y++) {
yl = (WORD *)(dp + y * ds->bytes_per_line);
yl = (uint16_t *)(dp + y * ds->bytes_per_line);
for (x = 0; x < dw; x++) {
r = *sp;
g = *(sp +1);
@@ -78,10 +78,10 @@ void gr_drawimage24(surface_t *ds, cgdata *cg, int x, int y) {
case 24:
case 32:
{
DWORD *yl;
uint32_t *yl;
for (y = 0; y < dh; y++) {
yl = (DWORD *)(dp + y * ds->bytes_per_line);
yl = (uint32_t *)(dp + y * ds->bytes_per_line);
for (x = 0; x < dw; x++) {
r = *sp;
g = *(sp +1);
@@ -105,8 +105,8 @@ void gr_drawimage24(surface_t *ds, cgdata *cg, int x, int y) {
*/
void gr_drawimage16(surface_t *ds, cgdata *cg, int x, int y) {
int dx, dy, dw, dh;
BYTE *dp;
WORD pic16, *sp;
uint8_t *dp;
uint16_t pic16, *sp;
dx = x;
dy = y;
@@ -117,7 +117,7 @@ void gr_drawimage16(surface_t *ds, cgdata *cg, int x, int y) {
int data_offset = (abs(dy - y) * cg->width + abs(dx - x)) * 2;
sp = (WORD *)(cg->pic + data_offset);
sp = (uint16_t *)(cg->pic + data_offset);
dp = GETOFFSET_PIXEL(ds, dx, dy);
switch(ds->depth) {
@@ -134,13 +134,13 @@ void gr_drawimage16(surface_t *ds, cgdata *cg, int x, int y) {
case 24:
case 32:
{
DWORD *yl;
uint32_t *yl;
for (y = 0; y < dh; y++) {
yl = (DWORD *)(dp + y * ds->bytes_per_line);
yl = (uint32_t *)(dp + y * ds->bytes_per_line);
for (x = 0; x < dw; x++) {
pic16 = *sp;
*yl = PIX24(PIXR16(pic16), PIXG16(pic16), PIXB16(pic16));
*yl = rgb565_to_rgb888(pic16);
yl++; sp++;
}
sp += (cg->width - dw);
+1 -1
View File
@@ -42,7 +42,7 @@
* @param sh:
*/
int gr_copy(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int sw, int sh) {
BYTE *sp, *dp;
uint8_t *sp, *dp;
if (src == NULL || dst == NULL) return NG;
if (!gr_clip(src, &sx, &sy, &sw, &sh, dst, &dx, &dy)) return NG;
+3 -3
View File
@@ -42,7 +42,7 @@
* @param sh:
*/
int gr_copy_alpha_map(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int sw, int sh) {
BYTE *sp, *dp;
uint8_t *sp, *dp;
if (!gr_clip(src, &sx, &sy, &sw, &sh, dst, &dx, &dy)) return NG;
@@ -50,12 +50,12 @@ int gr_copy_alpha_map(surface_t *dst, int dx, int dy, surface_t *src, int sx, in
dp = GETOFFSET_ALPHA(dst, dx, dy);
if (sp == NULL) {
WARNING("src alpha NULL\n");
WARNING("src alpha NULL");
return NG;
}
if (dp == NULL) {
WARNING("dst alpha NULL\n");
WARNING("dst alpha NULL");
return NG;
}
+7 -7
View File
@@ -9,7 +9,7 @@
void gr_copy_bright(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int width, int height, int lv) {
int x, y;
BYTE *sp, *dp;
uint8_t *sp, *dp;
if (!gr_clip(src, &sx, &sy, &width, &height, dst, &dx, &dy)) return;
@@ -21,11 +21,11 @@ void gr_copy_bright(surface_t *dst, int dx, int dy, surface_t *src, int sx, int
switch(dst->depth) {
case 16:
{
WORD *yls, *yld;
uint16_t *yls, *yld;
for (y = 0; y < height; y++) {
yls = (WORD *)(sp + y * src->bytes_per_line);
yld = (WORD *)(dp + y * dst->bytes_per_line);
yls = (uint16_t *)(sp + y * src->bytes_per_line);
yld = (uint16_t *)(dp + y * dst->bytes_per_line);
for (x = 0; x < width; x++) {
*yld = ALPHALEVEL16(*yls, lv);
@@ -37,11 +37,11 @@ void gr_copy_bright(surface_t *dst, int dx, int dy, surface_t *src, int sx, int
case 24:
case 32:
{
DWORD *yls, *yld;
uint32_t *yls, *yld;
for (y = 0; y < height; y++) {
yls = (DWORD *)(sp + y * src->bytes_per_line);
yld = (DWORD *)(dp + y * dst->bytes_per_line);
yls = (uint32_t *)(sp + y * src->bytes_per_line);
yld = (uint32_t *)(dp + y * dst->bytes_per_line);
for (x = 0; x < width; x++) {
*yld = ALPHALEVEL24(*yls, lv);
+2 -2
View File
@@ -6,9 +6,9 @@
#include "ngraph.h"
#include "ags.h"
int gr_draw_amap(surface_t *dst, int dx, int dy, BYTE *src, int width, int height, int scanline) {
int gr_draw_amap(surface_t *dst, int dx, int dy, uint8_t *src, int width, int height, int scanline) {
int y;
BYTE *sp, *dp;
uint8_t *sp, *dp;
sp = src;
dp = GETOFFSET_ALPHA(dst, dx, dy);
+11 -11
View File
@@ -7,7 +7,7 @@
#include "ags.h"
int gr_expandcolor_blend(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int sw, int sh, int r, int g, int b) {
BYTE *sp, *dp;
uint8_t *sp, *dp;
int x, y;
int col;
@@ -22,14 +22,14 @@ int gr_expandcolor_blend(surface_t *dst, int dx, int dy, surface_t *src, int sx,
case 16:
col = PIX16(r, g, b);
{
WORD *yd;
BYTE *ys;
uint16_t *yd;
uint8_t *ys;
for (y = 0; y < sh; y++) {
ys = (BYTE *)(sp + y * src->bytes_per_line);
yd = (WORD *)(dp + y * dst->bytes_per_line);
ys = (uint8_t *)(sp + y * src->bytes_per_line);
yd = (uint16_t *)(dp + y * dst->bytes_per_line);
for (x = 0; x < sw; x++) {
if (*ys) {
*yd = ALPHABLEND16(col, *yd, (BYTE)*ys);
*yd = ALPHABLEND16(col, *yd, (uint8_t)*ys);
}
ys++; yd++;
}
@@ -38,15 +38,15 @@ int gr_expandcolor_blend(surface_t *dst, int dx, int dy, surface_t *src, int sx,
break;
case 32:
case 24: {
DWORD *yd;
BYTE *ys;
uint32_t *yd;
uint8_t *ys;
col = PIX24(r, g, b);
for (y = 0; y < sh; y++) {
ys = (BYTE *)(sp + y * src->bytes_per_line);
yd = (DWORD *)(dp + y * dst->bytes_per_line);
ys = (uint8_t *)(sp + y * src->bytes_per_line);
yd = (uint32_t *)(dp + y * dst->bytes_per_line);
for (x = 0; x < sw; x++) {
if (*ys) {
*yd = ALPHABLEND24(col, *yd, (BYTE)*ys);
*yd = ALPHABLEND24(col, *yd, (uint8_t)*ys);
}
ys++; yd++;
}
+5 -5
View File
@@ -7,7 +7,7 @@
#include "ags.h"
int gr_fill(surface_t *dst, int dx, int dy, int dw, int dh, int r, int g, int b) {
BYTE *dp, *dp_;
uint8_t *dp, *dp_;
int x, y;
if (!gr_clip_xywh(dst, &dx, &dy, &dw, &dh)) {
@@ -23,10 +23,10 @@ int gr_fill(surface_t *dst, int dx, int dy, int dw, int dh, int r, int g, int b)
case 16:
{
WORD pic16 = PIX16(r, g, b);
uint16_t pic16 = PIX16(r, g, b);
for (x = 0; x < dw; x++) {
*((WORD *)dp + x) = pic16;
*((uint16_t *)dp + x) = pic16;
}
break;
@@ -34,10 +34,10 @@ int gr_fill(surface_t *dst, int dx, int dy, int dw, int dh, int r, int g, int b)
case 24:
case 32:
{
DWORD pic24 = PIX24(r, g, b);
uint32_t pic24 = PIX24(r, g, b);
for (x = 0; x < dw; x++) {
*((DWORD *)dp + x) = pic24;
*((uint32_t *)dp + x) = pic24;
}
break;

Some files were not shown because too many files have changed in this diff Show More