Compare commits

...
49 Commits
Author SHA1 Message Date
kichikuou 97b8bcb22a Fix argument for SDL_JoystickEventState 2020-10-01 16:46:20 +09:00
kichikuou 862f639e2e Fix ShString.FillString 2020-09-21 18:02:32 +09:00
kichikuou 316a06a168 Refactor string variable functions
This replaces v_str* functions with new svar_* functions.
The new svar_* functions use 1-based string variable index, so that
callers don't have to decrement string numbers from SCO.
2020-09-21 16:17:23 +09:00
kichikuou c9ec20dcc8 Remove no field of agsurface_t 2020-09-21 13:24:12 +09:00
kichikuou 023b8cd455 VSP: Do not use static extraction buffer
Now it's allocated on the stack. Up to 401*8 bytes, should be fine.
2020-09-21 12:01:20 +09:00
kichikuou 335681863c VSP: Appropriately scale 4-bit color to 8-bit
This fixes a bug where VSP image was displayed slightly darker than the
original.
2020-09-21 11:46:48 +09:00
kichikuou ecba592d82 TECH.TXT: Typo fixes and minor corrections 2020-09-21 11:03:13 +09:00
kichikuou dbac18c260 Globally replace "pallet" with "palette" 2020-09-19 22:25:10 +09:00
kichikuou ed8f610f80 Remove unused xpg_basename.c 2020-09-16 18:36:03 +09:00
kichikuou f753cf8670 SDL: Show quit confirmation dialog on SDL_QUIT 2020-09-12 18:59:32 +09:00
kichikuou c3cc4f3e44 menu_sdl.c: Implement menu_msgbox_open() 2020-09-12 18:27:51 +09:00
kichikuou e57913bfc6 Revive menu_null.c
It's used only if graphic backend is X11 and libgtk2 is not available.
2020-09-12 18:18:34 +09:00
kichikuou f941916fb2 CI: Install libgtk2.0-dev in X11 build 2020-09-12 16:56:41 +09:00
kichikuou f5248bda8a Merge sdl_mode.c to sdl_video.c 2020-09-10 15:42:27 +09:00
kichikuou 988a072964 Rename menu_null.c to menu_sdl.c 2020-09-10 15:25:02 +09:00
kichikuou 775b34cf1a SDL: Implement inline text input (for MJ command)
Very few games use it (Mamorigami-sama and Les Chairs Cruelles), but
this could be reused when we add a pure SDL implementation of input
dialogs.
2020-09-07 22:33:31 +09:00
kichikuou 5455bce8d6 Rename sdl_input.c to sdl_keytable.h
And move xsyskey.pl to tools/.
2020-09-06 13:58:09 +09:00
kichikuou 5e5defb6bc Android: Input dialog truncates string that exceeds maximum length 2020-09-06 10:35:35 +09:00
kichikuou 05cca544c6 Text input commands should accept half-width characters
Although its dialog message says "Half-width characters cannot be used",
System3.9 does not prevent users from entering half-width characters.
2020-09-05 22:40:23 +09:00
kichikuou 38758569bb Android: Implement input dialogs 2020-09-04 17:03:01 +09:00
kichikuou e417811a94 emscripten: Implement messagebox and number input dialog 2020-09-04 17:03:01 +09:00
kichikuou b509be2b64 Remove unused menu_widget_reinit() 2020-09-04 11:34:24 +09:00
kichikuou fa845a6439 MIDI: Keep track of current music number in music_midi.c 2020-08-30 17:21:03 +09:00
kichikuou b3cb185a35 Simplify cg_load
Before this, cg_load() skipped loading CG or loaded only palettes,
depending on the flags set by the PC command.

After this, it always loads a CG and populates the cache. Functions for
loading only palettes have been removed. Actually this may be good for
performance, because some games use `PC 0:` to prewarm the cache.
2020-08-30 15:39:42 +09:00
kichikuou 87413d54dc Fix SC command
This fixes a bug where SC command did not return 999/999/999/999 when
CD-DA is not available.
2020-08-30 13:55:20 +09:00
kichikuou 440fb93b08 Fix memory leak in sprite_update.c 2020-08-30 12:17:46 +09:00
kichikuou 6d1ef1ba6f Fix memory leak in cursor_load 2020-08-30 11:20:29 +09:00
kichikuou dd1f0fd230 Fix memory leak in ags_setWorldSize
SetWorldSize() replaces the DIB, so alpha buffer must be freed before
calling it.
2020-08-30 10:33:45 +09:00
kichikuou 15fb122148 Remove agsurface.has_{pixel,alpha} fields 2020-08-30 10:26:55 +09:00
kichikuou 91a6cf7e67 Fix out-of-bounds memory access in font_ttf_get_glyph
FT_GlyphSlot.bitmap_left can be negative.
2020-08-30 09:58:09 +09:00
kichikuou dc8025469a Fix memory leak in msg_openWindow 2020-08-29 22:36:59 +09:00
kichikuou 0bbace898d Fix memory leak in save_saveAll 2020-08-29 22:04:34 +09:00
kichikuou c4e5ef3c36 Fix usage message 2020-08-29 19:10:55 +09:00
kichikuou e039fb3193 Fix memory leak in qnt_extract 2020-08-29 18:47:21 +09:00
kichikuou e547c153fc emscripten: Call sys_getInputInfo() at least once per frame
This fixes Graymerca, which checks input only with IG command.
2020-08-29 12:38:01 +09:00
kichikuou fef74da3dd emscripten: Enable JPEG 2020-08-26 20:23:56 +09:00
kichikuou 7baab6b616 Android CI: Use the system's default JDK 2020-08-23 14:09:37 +09:00
kichikuou 54b219e435 Android: Update build instructions to use commandline-tools
Now it works with JDK 9+.
2020-08-23 13:23:21 +09:00
kichikuou a20363b901 Android: Upgrade build environment
- targetSdkVersion 28
- Android Gradle plugin 4.0.1
- Kotlin 1.3.72
- Gradle 6.1.1
2020-08-23 11:22:05 +09:00
kichikuou bc9fc924ed [experimental] Unicode mode
This adds "Unicode mode", in which scenarios can be written in any
language. xsys35c 1.2.0 and later can produce Unicode scenarios.

- nact->encoding represents the current scenario encoding. The initial
  value is SJIS, and ZU command changes it to UTF8.

- Use conversion macros that switch the behavior by the scenario
  encoding. For example, toUTF8() calls sjis2utf() if the scenario
  encoding is SJIS, and calls strdup() if it is UTF8.

- Fix various string processing functions to work with UTF8.
2020-08-09 21:24:56 +09:00
kichikuou d8fbf9a8b1 Cleanup 2020-08-09 13:41:26 +09:00
kichikuou 077e4d32e0 Fix emscripten build 2020-08-08 23:07:53 +09:00
kichikuou 652e4b9111 Simplify ags_drawStringToSurface() 2020-08-08 22:57:22 +09:00
kichikuou 3cecc58607 Narrow dependency on font.h
This removes font.h dependency from header files such as ags.h and
nact.h. After this, font.h must be explicitly included in order to use
font functions.
2020-08-08 22:52:47 +09:00
kichikuou f31742a503 Font functions only handle utf-8 strings
Conversion from Shift_JIS is done in ags.c.
2020-08-08 22:03:58 +09:00
kichikuou e830190537 Add ags_drawStringToSurface() 2020-08-08 21:28:01 +09:00
kichikuou 7d8458c86d Emscripten: Remove getMemory from EXTRA_EXPORTED_RUNTIME_METHODS 2020-08-08 14:29:44 +09:00
kichikuou dfc10a7f34 Update emscripten to 1.40.1 2020-08-08 10:35:23 +09:00
kichikuou a5684cffa4 Switch README.md to English, and add a link to the releases page 2020-08-06 19:28:15 +09:00
122 changed files with 1643 additions and 1279 deletions
+1 -6
View File
@@ -11,15 +11,10 @@ jobs:
- name: Install Deps
run: sudo apt install ninja-build
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build
run: |
cd android
./gradlew assembleRelease
ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle ./gradlew assembleRelease
- name: Upload artifacts
uses: actions/upload-artifact@v1
+1 -1
View File
@@ -2,7 +2,7 @@ name: Emscripten Build
on: [push, pull_request]
env:
emscripten-version: 1.39.16
emscripten-version: 1.40.1
jobs:
build:
+5
View File
@@ -35,6 +35,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install Deps
run: |
sudo apt update
sudo apt install libgtk2.0-dev
- name: Build
run: |
mkdir -p out
+19 -14
View File
@@ -38,6 +38,7 @@ check_symbol_exists(uname "sys/utsname.h" HAVE_UNAME)
if (EMSCRIPTEN)
set(SDL2_FOUND 1)
set(FREETYPE_FOUND 1)
set(HAVE_JPEG 1)
set(DEFAULT_FONT_PATH /fonts/)
elseif (ANDROID)
if (NOT DEFINED ENABLE_MODULES)
@@ -84,10 +85,25 @@ else()
endif()
# Graphics
if (X11_FOUND)
set(SRC_GRAPHDEV xcore_draw.c xcore_video.c xcore_mode.c xcore_event.c xcore_cursor.c xcore_maskupdate.c image.c xcore_image.c)
set(SUMMARY_GRAPHDEV "X11")
elseif (SDL2_FOUND)
set(SRC_GRAPHDEV sdl_video.c sdl_draw.c sdl_event.c sdl_image.c sdl_cursor.c image.c)
set(SUMMARY_GRAPHDEV "SDL2")
set(ENABLE_SDL 1)
else()
message(FATAL_ERROR "*** No graphic device available ***")
endif()
# Menu
if (EMSCRIPTEN)
set(SRC_MENU menu_emscripten.c)
elseif (ANDROID)
set(SRC_MENU menu_android.c)
elseif (GTK2_FOUND)
set(SRC_MENU menu.c menu_callback.c menu_gui.c s39init.c)
@@ -100,23 +116,12 @@ elseif (GTK2_FOUND)
include_directories(${Intl_INCLUDE_DIRS})
link_libraries(${Intl_LIBRARIES})
endif()
else()
elseif (ENABLE_SDL)
set(SRC_MENU menu_sdl.c sdl_input.c)
else ()
set(SRC_MENU menu_null.c)
endif()
# Graphics
if (X11_FOUND)
set(SRC_GRAPHDEV xcore_draw.c xcore_video.c xcore_mode.c xcore_event.c xcore_cursor.c xcore_maskupdate.c image.c xcore_image.c)
set(SUMMARY_GRAPHDEV "X11")
elseif (SDL2_FOUND)
set(SRC_GRAPHDEV sdl_video.c sdl_mode.c sdl_draw.c sdl_event.c sdl_image.c sdl_cursor.c image.c)
set(SUMMARY_GRAPHDEV "SDL2")
set(ENABLE_SDL 1)
else()
message(FATAL_ERROR "*** No graphic device available ***")
endif()
# PCM audio
if (EMSCRIPTEN)
+11 -11
View File
@@ -1,24 +1,24 @@
# xsytem35-sdl2
アリスソフトのゲームエンジン System3.x のフリー実装である xsystem35 を SDL2 に対応して、emscripten でコンパイルできるようにしたものです。
This is a multi-platform port of xsystem35, a free implementation of AriceSoft's System3.x game engine.
## ビルド方法
### Linux
## Download
Prebuilt binaries for Windows and Android can be downloaded from the [Releases](https://github.com/kichikuou/xsystem35-sdl2/releases) page.
[cmake](https://cmake.org/) が必要です。
## Build
### Linux (Debian / Ubuntu)
$ sudo apt install build-essential cmake libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev
$ mkdir -p out/debug
$ cd out/debug
$ cmake -DCMAKE_BUILD_TYPE=Debug ../../
$ make && make install
cmake の実行でエラーになる場合は必要なライブラリをインストールしてください。
グラフィックスシステムとして X11 と SDL2 が使用可能です。両方存在する場合は X11 が優先されますが、`cmake` のオプションに `-DENABLE_X11=NO` を指定すると SDL2 が使われます。
You can choose between X11 and SDL2 as the graphics backend. If both libraries are found, X11 is used by default, but if `-DENABLE_X11=NO` flag is given to the `cmake` invocation, then SDL2 will be used.
### MacOS
[Homebrew](https://brew.sh/index_ja) が必要です。
[Homebrew](https://brew.sh/index_ja) is needed.
$ brew install cmake pkg-config sdl2 sdl2_mixer freetype libjpeg
$ mkdir -p out/debug
@@ -28,7 +28,7 @@ cmake の実行でエラーになる場合は必要なライブラリをイン
### Windows
[MSYS2](https://www.msys2.org) が必要です。
[MSYS2](https://www.msys2.org) is needed.
$ 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-libjpeg-turbo
$ mkdir -p out/debug
@@ -43,8 +43,8 @@ cmake の実行でエラーになる場合は必要なライブラリをイン
$ emcmake cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../../
$ make
実行するには、[鬼畜王 on Webのリポジトリ](https://github.com/kichikuou/web)をチェックアウトして、`docs`ディレクトリに `out/xsystem35.*` をすべてコピーしてください。
To use the generated binary, checkout [Kichikuou on Web](https://github.com/kichikuou/web) and copy `out/xsystem35.*` into its `docs` directory.
### Android
[android/README.md](android/) を参照してください。
See [android/README.md](android/).
+10 -11
View File
@@ -6,7 +6,7 @@ Prebuilt APKs are [here](https://github.com/kichikuou/xsystem35-sdl2/releases).
## Build
Prerequisites:
- CMake >=3.13
- Android SDK >=26
- Android SDK >=28
- Android NDK >=r15c
### Using Android Studio
@@ -15,20 +15,19 @@ Open this directory as an Android Studio project.
### Command line build
Configure environment variables and run the `gradlew` script in this folder.
Example build instructions (for Debian Stretch):
Example build instructions (for Debian buster):
```sh
# Install necessary packages
sudo apt install git wget unzip default-jdk-headless ninja-build
sudo apt -t stretch-backports install cmake
sudo apt install git wget unzip default-jdk-headless cmake ninja-build
# Install Android SDK / NDK
export ANDROID_HOME=$HOME/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d $ANDROID_HOME
yes |$ANDROID_HOME/tools/bin/sdkmanager --licenses
$ANDROID_HOME/tools/bin/sdkmanager ndk-bundle
export ANDROID_SDK_ROOT=$HOME/android-sdk
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools
wget https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip
unzip commandlinetools-linux-6609375_latest.zip -d $ANDROID_SDK_ROOT/cmdline-tools
yes |$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager --licenses
$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager ndk-bundle
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle
# Check out and build xsystem35
git clone https://github.com/kichikuou/xsystem35-sdl2.git
+3 -3
View File
@@ -1,4 +1,4 @@
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY')
def buildAsApplication = !buildAsLibrary
if (buildAsApplication) {
apply plugin: 'com.android.application'
@@ -9,13 +9,13 @@ else {
apply plugin: 'kotlin-android'
android {
compileSdkVersion 26
compileSdkVersion 28
defaultConfig {
if (buildAsApplication) {
applicationId "io.github.kichikuou.xsystem35"
}
minSdkVersion 19
targetSdkVersion 26
targetSdkVersion 28
versionCode 4
versionName "0.2.1"
externalNativeBuild {
@@ -17,9 +17,13 @@
*/
package io.github.kichikuou.xsystem35
import android.app.AlertDialog
import android.media.MediaPlayer
import android.os.Bundle
import android.text.InputType
import android.util.Log
import android.widget.EditText
import android.widget.NumberPicker
import org.libsdl.app.SDLActivity
import java.io.File
import java.io.IOException
@@ -74,13 +78,81 @@ class GameActivity : SDLActivity() {
Launcher.updateGameList()
}
// These functions are called in the SDL thread by JNI.
private fun textInputDialog(msg: String, oldVal: String, maxLen: Int, result: Array<String?>) {
val input = EditText(this)
input.inputType = InputType.TYPE_CLASS_TEXT
input.setText(oldVal)
AlertDialog.Builder(this)
.setMessage(msg)
.setView(input)
.setPositiveButton(R.string.ok) {_, _ ->
result[0] = input.text.toString().substring(0, maxLen)
}
.setNegativeButton(R.string.cancel) {_, _ -> }
.setOnDismissListener {
synchronized(result) {
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (result as Object).notify()
}
}
.show()
}
private fun numberInputDialog(msg: String, min: Int, max: Int, initial: Int, result: IntArray) {
val input = NumberPicker(this)
input.minValue = min
input.maxValue = max
input.value = initial
AlertDialog.Builder(this)
.setMessage(msg)
.setView(input)
.setPositiveButton(R.string.ok) {_, _ ->
input.clearFocus()
result[0] = input.value
}
.setNegativeButton(R.string.cancel) {_, _ -> }
.setOnDismissListener {
synchronized(result) {
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (result as Object).notify()
}
}
.show()
}
// 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()
@Suppress("unused") fun inputString(msg: String, oldVal: String, maxLen: Int): String? {
val result = arrayOfNulls<String?>(1)
runOnUiThread { textInputDialog(msg, oldVal, maxLen, result) }
// Block the calling thread.
synchronized(result) {
try {
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (result as Object).wait()
} catch (ex: InterruptedException) {
ex.printStackTrace()
}
}
return result[0]
}
@Suppress("unused") fun inputNumber(msg: String, min: Int, max: Int, initial: Int): Int {
val result = intArrayOf(-1)
runOnUiThread { numberInputDialog(msg, min, max, initial, result) }
// Block the calling thread.
synchronized(result) {
try {
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (result as Object).wait()
} catch (ex: InterruptedException) {
ex.printStackTrace()
}
}
return result[0]
}
}
private class CddaPlayer(private val playlistPath: File) {
+2 -2
View File
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.61'
ext.kotlin_version = '1.3.72'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
+2 -2
View File
@@ -1,6 +1,6 @@
#Mon Oct 23 13:51:26 PDT 2017
#Mon Aug 10 12:24:31 JST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
+49 -49
View File
@@ -84,7 +84,7 @@
必要に応じてシナリオ内の変数に読み込みます。
f) リソースファイルは、マウスカーソルの形状とアニメーションマウスカーソルの
データを格納しています。これまで DARCROW でのみ使用されました。
データを格納しています。これまで DARCROWS でのみ使用されました。
g) セーブデータは、システム管理情報と数値変数、文字列変数のすべてを含んだ
全セーブデータ(*.asd)と数値変数・文字列変数の一部を保存したデータの2種類が
@@ -94,17 +94,17 @@
h) その他のデータの範疇に入るものとしては外字ファイルとデータファイルがあり
ます。
外字ファイルは、PC9801の外字領域に16x16ドットのビットマップデータを並べた
もので、オリジナルの外字を表示させるのに加えて、98機種依存文字の吸収も目指
もので、オリジナルの外字を表示させるのに加えて、PC98機種依存文字の吸収も目指
していたのですが、結局外字ファイルは「いけないかつみ先生」で使われたのみで、
SYSTEM35.EXE Version 2.x 以降ではサポートすらされなくなりました。また、機種
依存文字(まる文字やギリシャ数字など)はそれ以降のゲームでも機種存のコードで
依存文字(まる文字やギリシャ数字など)はそれ以降のゲームでも機種存のコードで
継続して使われています。SYSTEM 3.9 では再び外字のサポートが復活するようです。
データファイルは、基本的には、シナリオ変数を外部に保存したものと考える事
ができます。マップデータのようにあらかじめゲームに附属しているものもあれば、
ゲームの途中経過を記録するために、ファイルに書き出す事もあります。
かえるにょぱにょんのマップデータ等のように e)のデータファイルで代用でき
ものもあります。
かえるにょぱにょんのマップデータ等のように e)のデータファイルで代用でき
ものもあります。
3. データファイル (.ald) のフォーマット
@@ -143,15 +143,15 @@
data そのものについても、ヘッダと実データに分ける事が出来ます。ヘッダは
32バイト以上の長さで次のようになっています。
int32 prt;
int32 ptr;
int32 size;
int32 time_l;
int32 time_h;
char name[?];
ptr は実際のデータへのヘッダからの相対アドレスです。size はデータの大きさを
表します。 time_l と time_h は Windows 特有(?)の値で、データの作成時間をユリ
ウス歴の最初の日付からの経過時間をナノ秒で表したものです。name はアーカイブ
表します。 time_l と time_h は Windows の FILETIME 型の値で、データの作成時
を1601-01-01からの100ナノ秒単位の経過時間で表したものです。name はアーカイブ
する前のデータのファイル名で、16バイト以上の長さがあります。16バイト未満の時
は0でパディングされます。またヘッダとデータを併せて 256バイト単位になるよう
にデータの後ろは0でパディングされます。
@@ -200,26 +200,26 @@
int16 width;
int16 height;
int8 rsv;
int8 pallet_bank;
int8 palette_bank;
int8 pal[3*16];
(x0,y0) は、CGを表示する位置を表します。シナリオから表示位置の指定のない場合
この値を使います。x0 は 8で割った大きさになっていますので、x0=10 とあった
合は実際には (80,y0) の位置に表示します。
この値を使います。x0 は 8で割った大きさになっていますので、x0=10 とあった
合は実際には (80,y0) の位置に表示します。
(width, height) は CG の大きさを表します。widthは実際には8で割った大きさに
なっています。これは、プレーン型のデータが元になっているためです。プレーン型
のデータの場合、1バイトで表されるのは8ピクセル分だったため、width にいれる
値は占めるバイト数を格納した方が有利だっためと考えられます。よってCGの横の
値は占めるバイト数を格納した方が有利だっためと考えられます。よってCGの横の
サイズは常に8の倍数になります。8の倍数以外にしたい場合は、余る部分を透過
パレット(スプライト)とする事で実現出来ます。
rsv は現在のところ、使われていません。
pallet_bank は、SYSTEM 3 の時代に 256色対応ゲームで、VSPファイルを読み込ませ
palette_bank は、SYSTEM 3 の時代に 256色対応ゲームで、VSPファイルを読み込ませ
るために、256個のパレットのどの場所に 16色分のパレットを置くかを決めます。
bank=0 で 0-15, bank=1 で 16-31 となります。実装方法としては、plane->packed
の変換の際に上位4bitにpalletを置いた場所の bitを立てます。bank=1 なら '| 0x10'
の変換の際に上位4bitにpaletteを置いた場所の bitを立てます。bank=1 なら '| 0x10'
という具合です。シナリオ側からパレットバンクを指定することもできます。しかし、
シナリオ側から1度もパレットバンクの指定が無い場合はこのヘッダ内の情報が使用
されます。(これは実装依存かもしれません)
@@ -234,7 +234,7 @@
です。
00, len;
一つ上のプレーンと(len+1)の長さだけ同じ
同じプレーンの一つ左の列と(len+1)の長さだけ同じ
01, len, pic;
1バイト(pic)の繰り返し。長さは(len+1)
@@ -277,32 +277,32 @@
int8 bpp;
int8 bppS;
int8 trans_pal;
int16 palett_bank;
int32 rsv;
int8 rsv1;
int16 palette_bank;
int32 rsv2;
int32 x0;
int32 y0;
int32 width;
int32 height;
int32 data_ptr;
int32 pallet_ptr;
int32 palette_ptr;
int32 comment_ptr;
sig はデータのマジックナンバーで 'PM' というデータが入っています。
ver はデータのバージョンで、現在は 1 が入っています。
bpp はデータの bit per pixel で 8または16です。256色データの場合は 8、64k色
の場合は 16です。
bpp はデータの bits per pixel で256色データの場合は 8、64k色の場合は16です。
bppsはαチャンネルの bit per pixel で通常は8です。
bppsはαチャンネルの bits per pixel で通常は8です。
trans_pal は透過するパレットの番号です。通常はシナリオから指定が来るので
使用しません。
pallet_bank は データの中のパレットのどの部分をシステムに転送するかを
palette_bank は データの中のパレットのどの部分をシステムに転送するかを
表します。通常は 256個全部転送するのですが、CGデータがそれ以下しか色を使って
ない場合には、一部のみ転送することができます。pallet_bank は 16bit の情報を
持ち 256個を 16個つに分割してどの部分を転送するかを指定します。bit-on で
ない場合には、一部のみ転送することができます。palette_bank は 16bit の情報を
持ち 256個を 16個つに分割してどの部分を転送するかを指定します。bit-on で
転送です。LSB が0-15, MSB が 240-255 です。
(x0, y0) は CG の表示位置です。VSP と違って8で割った大きさではなく実際の
@@ -312,10 +312,10 @@
data_ptr はデータ先頭からピクセルデータへの相対アドレスが入ります。
pallet_ptr は bppが8の場合にはパレットへの相対アドレスが入りますが、
palette_ptr は bppが8の場合にはパレットへの相対アドレスが入りますが、
16の場合にはαチャンネルデータへの相対アドレスが入ります。
comment_prt はデータにコメントをつける事ができて、そのデータへの相対アドレス
comment_ptr はデータにコメントをつける事ができて、そのデータへの相対アドレス
を指定します。
パレット
@@ -333,31 +333,31 @@
2つ上のラインと同じ。長さは (len+3:8bit, len+2:16bit)
0xfd, len, pic,
1byte の picデータの連続。長さは (len+4:8bit, len+3:16bit)
1ピクセルの picデータの連続。長さは (len+4:8bit, len+3:16bit)
0xfc, len, pic1, pic2
2byte (pic1, pic2) データの連続。長さは ((len+3)*2:8bit, ((len+2)*2):16bit))
2ピクセル (pic1, pic2) データの連続。長さは ((len+3)*2:8bit, (len+2)*2:16bit)
0xfb
左上のデータと同じ。(PMS16専用)
左上のピクセルと同じ。(PMS16専用)
0xfa
右上のデータと同じ。(PMS16専用)
右上のピクセルと同じ。(PMS16専用)
0xf9, len, pic_h, pic_l1, pic_l2, .... (PMS16専用)
ピクセル間の色の差が小さいものの連続。長さは(len+1)
各ピクセルのうち、R の上位 3bit, G の 2bit, B の 2bit が同じで、R の下位
各ピクセルのうち、R の上位 3bit, G の 2bit, B の 3bit が同じで、R の下位
2bit, G の 4bit, B の 2bit が異なるとき、下位の異なる部分のみを pic_l2,
pic_l3... で表す。( RGB は 5bit, 6bit, 5bit で表される)
pic_h, pic_l1 で最初のピクセルを構成し、ここから、RGB の上位が同じで、下位の
異なる部分を pic_l2, pic_l3... で構成する
異なる部分を pic_l2, pic_l3... で構成する
0xf8, pic
picそのもの。コードと同じピクセル用。8bit では pic は 1byte, 16bit では 2byte.
0xf7-0x00
データそのもの 8bitでは 1byte, 16bit では 00-f7 の次のコードはすべて(00-ff)
使用してピクセルを構成。
データそのもの 8bitでは 1byte, 16bit では次の 1byte と合わせてピクセルを
構成。
4.3 QNT フォーマット
@@ -380,7 +380,7 @@
int32 width;
int32 height;
int32 bpp;
int32 rsv(?)
int32 rsv; (?)
int32 pixel_size;
int32 alpha_size;
@@ -420,7 +420,7 @@
header_size はヘッダの大きさをバイト数で表しています。Version 0 では 48
バイト固定です。
(x0, y0) は CG の表示位置の指定です
(x0, y0) は CG の表示位置の指定です
(width, height) は CG の大きさの指定です。
@@ -472,8 +472,8 @@
最新のものでは 'S380' となっています。途中混乱した時期があってこれと異なる
場合もあります。
dat_prt は実際のシナリオデータの先頭への相対アドレスです。また、シナリオ中の
ジャンプ命令のアドレスは、上のヘッダの最初からの相対アドレスを使用します。
data_ptr は実際のシナリオデータの先頭アドレスです。また、シナリオ中の
ジャンプ命令のアドレスは、上のヘッダの先頭からの相対アドレスを使用します。
size はヘッダを含めたデータのサイズを示しています。
@@ -534,21 +534,21 @@
04h 演算子(>= 以上)
数値は0から65535までの正の整数を扱えます。しかし、計算式上では word 定数は
3FFFh しかあつかえませんので、それ以上の値を扱う場合は演算子を使います。
3FFFh までしかあつかえませんので、それ以上の値を扱う場合は演算子を使います。
65536 以上の数値を扱ったり、浮動小数を扱う場合は、64ビット変数を使用します。
配列を除く変数の最大は論理的には16384 個ですが、実際には 2000 以下に実装上
限界があります。1000 以上になる場合は、配列変数を有効に使うと良いでしょう。
配列を除く変数は論理的には最大 16384 個ですが、実際には 2000 以下に実装上
限界があります。1000 以上になる場合は、配列変数を有効に使うと良いでしょう。
(xsystem35 の場合は 1024, 1.5.1pre1から 8192)
変数には、数値変数と配列変数があります。配列変数は、index 変数を用いた
アクセス方法と、var[]のようなアクセス方法があります。var[]では上の 3.51拡張
コードを使用して C0, 01, base_h, base_l, cali: というコーディングがなされま
コードを使用して C0, 01, base_h, base_l, cali: というエンコードがなされま
す。配列のベースとなる変数が (base_h << 8) + base_l で表され、インデックスは
cali で指定されます。インデックスは配列変数も使用可能です。ex. var10[var20[5]]
cali で指定されます。インデックスは配列参照も使用可能です。ex. var10[var20[5]]
計算式は逆ポーランド記述で格納されますので、基本的な処理はスタックからつの
数値または変数と1つの演算子を取り出して演算し、結果をスタックに戻します。
計算式は逆ポーランド記述で格納されますので、基本的な処理はスタックからつの
演算子と2つの数値または変数を取り出して演算し、結果をスタックに戻します。
この操作を 0x7f が出現するまで繰り返します。0x7f が来たら、スタックに残って
いる数値を取り出します。コマンドの引数として変数を要求している場合の計算式
は、変数へのポインタを返します。
@@ -657,8 +657,8 @@
wav** など小文字系のコマンドはすべて 0x2f, 0x??, にエンコードされます。
また引数として文字列を含むもの(ファイル名など)は、従来は ':' で終っていました
が、system 3.8 以降では '\0' で終わるようになり、これらコマンドは新規に 0x2f
コマンドとして新規に割り当てられました。
が、system 3.8 以降では '\0' で終わるようになり、これらコマンドは新規に
0x2f コマンドとして割り当てられました。
0x2f, 0x0a, cali *2: [wavLoad]
0x2f, 0x0b, cali *2: [wavPlay]
@@ -807,7 +807,7 @@
ここでは、コマンド表に載っていないけど、ゲームに出て来るものを紹介します。
5.8.1 VA
* 機能: ユニットアニメーション (かえるにょ・ぱにょん初出)
* 機能: ユニットアニメーション (かえるにょ・ぱにょん初出)
* フォーマット: VA getd, cali, cali, cali:
* VA0 : 制御用コマンド
@@ -821,7 +821,7 @@
VA0, no, 1, num:
no番のアニメーション開始。すぐに制御を戻す。
numはコマ数, 0の場合と開始位置と終了位置が同じな時はアニメーションは
動かずにコマ数だけが無限にされるカウント。
動かずにコマ数だけが無限にカウントされる
VA0, no, 2, num:
no番のアニメーション開始。終るまで制御を戻さない。
+7 -8
View File
@@ -120,10 +120,9 @@ static int load_cg_main(int no) {
sno = find_null_surface();
sf->no = sno;
suf[sno] = sf;
return sf->no;
return sno;
}
static void Init() {
@@ -165,7 +164,7 @@ static void Create() {
*var = 0;
} else {
int no = find_null_surface();
*var = s->no = no;
*var = no;
suf[no] = s;
}
@@ -193,7 +192,7 @@ static void CreatePixelOnly() {
*var = 0;
} else {
int no = find_null_surface();
*var = s->no = no;
*var = no;
suf[no] = s;
}
@@ -219,7 +218,7 @@ static void CreateAMapOnly() {
*var = 0;
} else {
int no = find_null_surface();
*var = s->no = no;
*var = no;
suf[no] = s;
}
@@ -243,7 +242,7 @@ static void IsSurface() {
if (s == NULL) {
*var = 0;
} else {
*var = (s->has_alpha && s->has_pixel) ? 1 : 0;
*var = (s->alpha && s->pixel) ? 1 : 0;
}
DEBUG_COMMAND("Gpx.IsSurface %d,%p:\n", p1, var);
@@ -265,7 +264,7 @@ static void IsPixel() {
if (s == NULL) {
*var = 0;
} else {
*var = s->has_pixel ? 1 : 0;
*var = s->pixel ? 1 : 0;
}
DEBUG_COMMAND("Gpx.IsPixel %d,%p:\n", p1, var);
@@ -287,7 +286,7 @@ static void IsAlpha() {
if (s == NULL) {
*var = 0;
} else {
*var = s->has_alpha ? 1 : 0;
*var = s->alpha ? 1 : 0;
}
DEBUG_COMMAND("Gpx.IsAlpha %d,%p:\n", p1, var);
+1 -1
View File
@@ -26,7 +26,7 @@ static void Start() {
int *p1 = getCaliVariable();
int p2 = getCaliValue();
msgskipfile = strdup(v_str(p2 -1));
msgskipfile = strdup(svar_get(p2));
DEBUG_COMMAND_YET("MsgSkip.Start %p,%d:\n", p1, p2);
}
+1 -1
View File
@@ -39,7 +39,7 @@ static void Init(void) { /* 0 */
}
static void InitGame() { /* 1 */
nact->ags.font->antialiase_on = TRUE;
ags_setAntialiasedStringMode(TRUE);
sys_setHankakuMode(2);
nact->msgout = ntmsg_add;
+1 -13
View File
@@ -104,7 +104,7 @@ void ntmsg_init() {
// 主人公名前
nt_sstr_regist_replace(utf2sjis(SNAME_RYO), utf2sjis(SNAME_RYO_DEF));
nt_sstr_regist_replace(fromUTF8(SNAME_RYO), fromUTF8(SNAME_RYO_DEF));
night.msg.cbmove = cb_mousemove;
night.msg.cbrelease = cb_keyrelease;
@@ -188,12 +188,6 @@ void ntmsg_add(const char *msg) {
if (msg[0] == '\0') return;
if (0) {
char *b = sjis2utf(msg);
fprintf(stderr, "add msg '%s'\n", b);
free(b);
}
len = MSGBUFMAX - (int)strlen(night.msgbuf);
if (len < 0) {
WARNING("buf shortage (%d)\n", len);
@@ -260,12 +254,6 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
dt_setfont(wFont, wSize);
if (1) {
char *b = sjis2utf(mbuf);
fprintf(stderr, "msg '%s'\n", b);
free(b);
}
cw = dt_drawtext_col(sp->u.msg.canvas,
sp->u.msg.dspcur.x,
sp->u.msg.dspcur.y,
+11 -25
View File
@@ -30,7 +30,6 @@
#include "portab.h"
#include "nact.h"
#include "system.h"
#include "utfsjis.h"
#include "ags.h"
#include "surface.h"
#include "ngraph.h"
@@ -204,24 +203,14 @@ int nt_scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumB
// 指定の文字列のCGを作成
int nt_scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cText) {
cginfo_t *i;
agsurface_t *glyph;
FONT *font;
if (0) {
char *b = sjis2utf(cText);
WARNING("str = '%s'\n", b);
free(b);
}
spcg_assert_no(wNumCG);
// 勝手に出ていいのかな?
if (strlen(cText) == 0) return OK;
font = nact->ags.font;
font->sel_font(FONT_GOTHIC, wSize);
glyph = font->get_glyph(cText);
ags_setFont(FONT_GOTHIC, wSize);
agsurface_t *glyph = ags_drawStringToSurface(cText);
i = malloc(sizeof(cginfo_t));
i->type = CG_SET;
i->no = wNumCG;
@@ -242,8 +231,6 @@ int nt_scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cTex
// 数字文字列のCGを作成
int nt_scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue) {
cginfo_t *i;
agsurface_t *glyph;
FONT *font;
char s[256], ss[256];
spcg_assert_no(wNumCG);
@@ -257,9 +244,8 @@ int nt_scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFi
}
sprintf(s, ss, wValue);
font = nact->ags.font;
font->sel_font(FONT_GOTHIC, wSize);
glyph = font->get_glyph(s);
ags_setFont(FONT_GOTHIC, wSize);
agsurface_t *glyph = ags_drawStringToSurface(s);
i = malloc(sizeof(cginfo_t));
i->type = CG_SET;
@@ -322,15 +308,15 @@ int nt_scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHe
i->refcnt = 0;
src = srccg->sf;
if (src->has_alpha) {
if (src->alpha) {
dst = sf_create_surface(wWidth, wHeight, src->depth);
} else {
dst = sf_create_pixel(wWidth, wHeight, src->depth);
}
if (src->has_pixel) {
if (src->pixel) {
gr_copy(dst, 0, 0, src, wX, wY, wWidth, wHeight);
}
if (src->has_alpha) {
if (src->alpha) {
gr_copy_alpha_map(dst, 0, 0, src, wX, wY, wWidth, wHeight);
}
@@ -363,17 +349,17 @@ int nt_scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, in
i->refcnt = 0;
src = srccg->sf;
if (src->has_alpha) {
if (src->alpha) {
dst = sf_create_surface(src->width, src->height, src->depth);
gr_fill_alpha_map(dst, 0, 0, src->width, src->height, 255);
} else {
dst = sf_create_pixel(src->width, src->height, src->depth);
}
if (src->has_pixel) {
if (src->pixel) {
gr_copy(dst, wX, wY, src, wX, wY, wWidth, wHeight);
}
if (src->has_alpha) {
if (src->alpha) {
gr_copy_alpha_map(dst, wX, wY, src, wX, wY, wWidth, wHeight);
}
@@ -498,7 +484,7 @@ int nt_scg_existalphamap(int wNumCG, int *ret) {
if (cgs[wNumCG] == NULL) goto errexit;
if (cgs[wNumCG]->sf == NULL) goto errexit;
*ret = cgs[wNumCG]->sf->has_alpha ? 1 : 0;
*ret = cgs[wNumCG]->sf->alpha ? 1 : 0;
errexit:
*ret = 0;
+2 -2
View File
@@ -4,7 +4,7 @@ static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mod
gr_copy(dst, 0, 0, base, 0, 0, base->width, base->height);
if (base->has_alpha) {
if (base->alpha) {
// ベースに alpha map がある場合はそれをコピー
gr_copy_alpha_map(dst, 0, 0, base, 0, 0, base->width, base->height);
} else {
@@ -12,7 +12,7 @@ static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mod
gr_fill_alpha_map(dst, 0, 0, base->width, base->height, 255);
}
if (blend->has_alpha) {
if (blend->alpha) {
// 重ね合わせ先の alpha map があるときはそれを使う
gre_BlendUseAMap(dst, x, y, base, x, y, blend, 0, 0, blend->width, blend->height, blend, 0, 0, 255);
} else {
+3 -5
View File
@@ -12,13 +12,11 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
dst->depth = src->depth;
dst->bytes_per_line = dw * src->bytes_per_pixel;
dst->bytes_per_pixel = src->bytes_per_pixel;
dst->has_pixel = src->has_pixel;
dst->has_alpha = src->has_alpha;
if (src->has_pixel) {
if (src->pixel) {
dst->pixel = malloc(dh * dst->bytes_per_line);
}
if (src->has_alpha) {
if (src->alpha) {
dst->alpha = malloc(dw * dh);
}
@@ -88,7 +86,7 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
break;
}
if (src->has_alpha) {
if (src->alpha) {
int x, y;
BYTE *sl, *dl;
BYTE *_sl, *_dl;
+1 -1
View File
@@ -118,7 +118,7 @@ int nt_sstr_num2str(int strno, int fig, int nzeropad, int num) {
}
sprintf(s, ss, num);
v_strcpy(strno -1, s);
svar_set(strno, s);
return OK;
}
+1 -1
View File
@@ -76,7 +76,7 @@ int nt_sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r) {
dx += r->x;
dy += r->y;
if (cg->sf->has_alpha) {
if (cg->sf->alpha) {
// alpha map がある場合
gre_BlendUseAMap(sf0, dx, dy,
sf0, dx, dy,
+11 -16
View File
@@ -67,28 +67,23 @@ static void disjunction(void* region, void* data) {
MyRectangle *r2 = (MyRectangle *)data;
int x1, x2, y1, y2;
//SACT_DEBUG("r1x=%d,r1y=%d,r1w=%d,r1h=%d\n", r1->x, r1->y, r1->width, r1->height);
//SACT_DEBUG("r2x=%d,r2y=%d,r2w=%d,r2h=%d\n", r2->x, r2->y, r2->width, r2->height);
if (r2->width == 0) {
r2->x = r1->x;
r2->y = r1->y;
r2->width = r1->width;
r2->height = r1->height;
return;
} else {
x1 = min(r1->x, r2->x);
x2 = max(r1->x + r1->width, r2->x + r2->width);
y1 = min(r1->y, r2->y);
y2 = max(r1->y + r1->height, r2->y + r2->height);
r2->x = x1;
r2->y = y1;
r2->width = x2 - x1;
r2->height = y2 - y1;
}
x1 = min(r1->x, r2->x);
x2 = max(r1->x + r1->width, r2->x + r2->width);
y1 = min(r1->y, r2->y);
y2 = max(r1->y + r1->height, r2->y + r2->height);
r2->x = x1;
r2->y = y1;
r2->width = x2 - x1;
r2->height = y2 - y1;
//SACT_DEBUG("res:r2x=%d,r2y=%d,r2w=%d,r2h=%d\n", r2->x, r2->y, r2->width, r2->height);
free(r1);
}
// 更新の必要なスプライトの領域の和をとってクリッピングする
+1 -1
View File
@@ -132,7 +132,7 @@ static void Init() {
sact.dmap = sf_create_pixel(sf0->width, sf0->height, 16);
// その他 System35 のデフォルト動作の変更
nact->ags.font->antialiase_on = TRUE;
ags_setAntialiasedStringMode(TRUE);
sys_setHankakuMode(2); // 全角半角変換無し
ags_autorepeat(FALSE); // key auto repeat off
+15 -29
View File
@@ -35,7 +35,6 @@
#include "sactcg.h"
#include "surface.h"
#include "ngraph.h"
#include "utfsjis.h"
#include "sactcg_stretch.c"
#include "sactcg_blend.c"
@@ -202,24 +201,14 @@ int scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlen
// 指定の文字列のCGを作成
int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, int wText) {
cginfo_t *i;
agsurface_t *glyph;
FONT *font;
if (0) {
char *b = sjis2utf(v_str(wText-1));
WARNING("str = '%s'\n", b);
free(b);
}
spcg_assert_no(wNumCG);
// 勝手に出ていいのかな?
if (v_strlen(wText -1) == 0) return OK;
font = nact->ags.font;
font->sel_font(FONT_GOTHIC, wSize);
glyph = font->get_glyph(v_str(wText -1));
if (svar_length(wText) == 0) return OK;
ags_setFont(FONT_GOTHIC, wSize);
agsurface_t *glyph = ags_drawStringToSurface(svar_get(wText));
i = malloc(sizeof(cginfo_t));
i->type = CG_SET;
i->no = wNumCG;
@@ -240,8 +229,6 @@ int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, int wText) {
// 数字文字列のCGを作成
int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue) {
cginfo_t *i;
agsurface_t *glyph;
FONT *font;
char s[256], ss[256];
spcg_assert_no(wNumCG);
@@ -254,11 +241,10 @@ int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs,
sprintf(ss, sss, wFigs);
}
sprintf(s, ss, wValue);
font = nact->ags.font;
font->sel_font(FONT_GOTHIC, wSize);
glyph = font->get_glyph(s);
ags_setFont(FONT_GOTHIC, wSize);
agsurface_t *glyph = ags_drawStringToSurface(s);
i = malloc(sizeof(cginfo_t));
i->type = CG_SET;
i->no = wNumCG;
@@ -320,15 +306,15 @@ int scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeigh
i->refcnt = 0;
src = srccg->sf;
if (src->has_alpha) {
if (src->alpha) {
dst = sf_create_surface(wWidth, wHeight, src->depth);
} else {
dst = sf_create_pixel(wWidth, wHeight, src->depth);
}
if (src->has_pixel) {
if (src->pixel) {
gr_copy(dst, 0, 0, src, wX, wY, wWidth, wHeight);
}
if (src->has_alpha) {
if (src->alpha) {
gr_copy_alpha_map(dst, 0, 0, src, wX, wY, wWidth, wHeight);
}
@@ -361,17 +347,17 @@ int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int w
i->refcnt = 0;
src = srccg->sf;
if (src->has_alpha) {
if (src->alpha) {
dst = sf_create_surface(src->width, src->height, src->depth);
gr_fill_alpha_map(dst, 0, 0, src->width, src->height, 255);
} else {
dst = sf_create_pixel(src->width, src->height, src->depth);
}
if (src->has_pixel) {
if (src->pixel) {
gr_copy(dst, wX, wY, src, wX, wY, wWidth, wHeight);
}
if (src->has_alpha) {
if (src->alpha) {
gr_copy_alpha_map(dst, wX, wY, src, wX, wY, wWidth, wHeight);
}
@@ -496,7 +482,7 @@ int scg_existalphamap(int wNumCG, int *ret) {
if (sact.cg[wNumCG] == NULL) goto errexit;
if (sact.cg[wNumCG]->sf == NULL) goto errexit;
*ret = sact.cg[wNumCG]->sf->has_alpha ? 1 : 0;
*ret = sact.cg[wNumCG]->sf->alpha ? 1 : 0;
errexit:
*ret = 0;
+2 -2
View File
@@ -4,7 +4,7 @@ static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mod
gr_copy(dst, 0, 0, base, 0, 0, base->width, base->height);
if (base->has_alpha) {
if (base->alpha) {
// ベースに alpha map がある場合はそれをコピー
gr_copy_alpha_map(dst, 0, 0, base, 0, 0, base->width, base->height);
} else {
@@ -12,7 +12,7 @@ static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mod
gr_fill_alpha_map(dst, 0, 0, base->width, base->height, 255);
}
if (blend->has_alpha) {
if (blend->alpha) {
// 重ね合わせ先の alpha map があるときはそれを使う
gre_BlendUseAMap(dst, x, y, base, x, y, blend, 0, 0, blend->width, blend->height, blend, 0, 0, 255);
} else {
+3 -5
View File
@@ -12,13 +12,11 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
dst->depth = src->depth;
dst->bytes_per_line = dw * src->bytes_per_pixel;
dst->bytes_per_pixel = src->bytes_per_pixel;
dst->has_pixel = src->has_pixel;
dst->has_alpha = src->has_alpha;
if (src->has_pixel) {
if (src->pixel) {
dst->pixel = malloc(dh * dst->bytes_per_line);
}
if (src->has_alpha) {
if (src->alpha) {
dst->alpha = malloc(dw * dh);
}
@@ -88,7 +86,7 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
break;
}
if (src->has_alpha) {
if (src->alpha) {
int x, y;
BYTE *sl, *dl;
BYTE *_sl, *_dl;
+1 -1
View File
@@ -47,7 +47,7 @@ int scryp_encrypt_str(int strno, int key) {
}
int scryp_decrypt_str(int strno, int key) {
WARNING("str = '%s'\n", v_str(strno -1));
WARNING("str = '%s'\n", svar_get(strno));
WARNING("NOT IMPLEMENTED\n");
return OK;
}
+5 -5
View File
@@ -43,7 +43,7 @@
#define LOGMSG_LINES 6
static const char *logmsg[LOGMSG_LINES] = {
static const char *logmsg_utf8[LOGMSG_LINES] = {
"\n",
"※バックログ操作方法※",
"[ESC]またはマウス右クリックでゲームに戻る",
@@ -110,15 +110,15 @@ static void draw_log() {
int sblog_start(void) {
static char *logmsg_sjis[6];
if (!logmsg_sjis[0]) {
static char *logmsg[LOGMSG_LINES];
if (!logmsg[0]) {
for (int i = 0; i < LOGMSG_LINES; i++)
logmsg_sjis[i] = utf2sjis(logmsg[i]);
logmsg[i] = fromUTF8(logmsg_utf8[i]);
}
// 説明文章を追加
for (int i = 0; i < LOGMSG_LINES; i++)
sact.log = list_append(sact.log, logmsg_sjis[i]);
sact.log = list_append(sact.log, logmsg[i]);
back = sf_dup(sf0);
chr = sf_create_surface(sf0->width, sf0->height, 8);
+5 -5
View File
@@ -56,7 +56,7 @@ int sstr_push(int strno) {
idxmax = idx*2;
}
stack[idx++] = strdup(v_str(strno -1));
stack[idx++] = strdup(svar_get(strno));
return OK;
}
@@ -68,7 +68,7 @@ int sstr_push(int strno) {
int sstr_pop(int strno) {
if (idx == 0) return NG;
v_strcpy(strno -1, stack[--idx]);
svar_set(strno, stack[--idx]);
free(stack[idx]);
return OK;
@@ -85,8 +85,8 @@ int sstr_regist_replace(int sstrno, int dstrno) {
if (sstrno == dstrno) return NG;
ex = malloc(sizeof(strexchange_t));
ex->src = strdup(v_str(sstrno -1));
ex->dst = strdup(v_str(dstrno -1));
ex->src = strdup(svar_get(sstrno));
ex->dst = strdup(svar_get(dstrno));
sact.strreplace = slist_append(sact.strreplace, ex);
return OK;
}
@@ -106,7 +106,7 @@ int sstr_num2str(int strno, int fig, int nzeropad, int num) {
}
sprintf(s, ss, num);
v_strcpy(strno -1, s);
svar_set(strno, s);
return OK;
}
+2 -2
View File
@@ -117,7 +117,7 @@ int sp_draw2(sprite_t *sp, cginfo_t *cg) {
dx += sact.updaterect.x;
dy += sact.updaterect.y;
if (cg->sf->has_alpha) {
if (cg->sf->alpha) {
// alpha map がある場合
gre_BlendUseAMap(sf0, dx, dy,
sf0, dx, dy,
@@ -175,7 +175,7 @@ void sp_draw_dmap(void* data, void* userdata) {
return;
}
if (cg->sf->has_alpha) {
if (cg->sf->alpha) {
fill_dmap_mask(cg->sf, sx, sy, dx, dy, w, h, sp->no);
} else {
fill_dmap(dx, dy, w, h, sp->no);
+5 -1
View File
@@ -1,3 +1,4 @@
#include <stdlib.h>
#include "ngraph.h"
#include "graph.h"
@@ -42,7 +43,10 @@ static void ec10_cb(surface_t *sfsrc, surface_t *sfdst) {
if (ec10_sf[0] == NULL) {
ec10_sf[0] = sf_dup2(sfsrc, FALSE, FALSE);
sf = ec10_sf[0];
sf->has_alpha = FALSE;
if (sf->alpha) {
free(sf->alpha);
sf->alpha = NULL;
}
gr_copy_stretch(sf, 0, 0, sf->width, sf->height, sfsrc, sx, sy, sw, sh);
gr_bright_dst_only(sf, 0, 0, sf->width, sf->height, 255/6);
return;
-13
View File
@@ -38,7 +38,6 @@
#include "ngraph.h"
#include "drawtext.h"
#include "sactlog.h"
#include "utfsjis.h"
// メッセージキー待ちの時、表示するアニメーションに関する情報
struct markinfo {
@@ -193,12 +192,6 @@ void smsg_add(const char *msg) {
if (msg[0] == '\0') return;
if (0) {
char *b = sjis2utf(msg);
fprintf(stderr, "add msg '%s'\n", b);
free(b);
}
len = MSGBUFMAX - (int)strlen(sact.msgbuf);
if (len < 0) {
WARNING("buf shortage (%d)\n", len);
@@ -304,12 +297,6 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
}
dt_setfont(wFont, wSize);
if (0) {
char *b = sjis2utf(mbuf);
fprintf(stderr, "msg '%s'\n", b);
free(b);
}
cw = dt_drawtext_col(sp->u.msg.canvas,
sp->u.msg.dspcur.x,
sp->u.msg.dspcur.y + wRSize + wRLineSpace,
+1 -1
View File
@@ -284,7 +284,7 @@ void ssel_add(int nString, int wI) {
free(sact.sel.elem[wI]);
}
sact.sel.elem[wI] = strdup(v_str(nString -1));
sact.sel.elem[wI] = strdup(svar_get(nString));
}
/*
+11 -16
View File
@@ -63,28 +63,23 @@ static void disjunction(void* region, void* data) {
MyRectangle *r2 = (MyRectangle *)data;
int x1, x2, y1, y2;
//SACT_DEBUG("r1x=%d,r1y=%d,r1w=%d,r1h=%d\n", r1->x, r1->y, r1->width, r1->height);
//SACT_DEBUG("r2x=%d,r2y=%d,r2w=%d,r2h=%d\n", r2->x, r2->y, r2->width, r2->height);
if (r2->width == 0) {
r2->x = r1->x;
r2->y = r1->y;
r2->width = r1->width;
r2->height = r1->height;
return;
} else {
x1 = min(r1->x, r2->x);
x2 = max(r1->x + r1->width, r2->x + r2->width);
y1 = min(r1->y, r2->y);
y2 = max(r1->y + r1->height, r2->y + r2->height);
r2->x = x1;
r2->y = y1;
r2->width = x2 - x1;
r2->height = y2 - y1;
}
x1 = min(r1->x, r2->x);
x2 = max(r1->x + r1->width, r2->x + r2->width);
y1 = min(r1->y, r2->y);
y2 = max(r1->y + r1->height, r2->y + r2->height);
r2->x = x1;
r2->y = y1;
r2->width = x2 - x1;
r2->height = y2 - y1;
//SACT_DEBUG("res:r2x=%d,r2y=%d,r2w=%d,r2h=%d\n", r2->x, r2->y, r2->width, r2->height);
free(r1);
}
// 更新の必要なスプライトの領域の和をとってクリッピングする
+2 -2
View File
@@ -67,7 +67,7 @@ int spxm_getnum(int reginum) {
int spxm_gettext(int reginum, int strno) {
if (reginum > SEL_ELEMENT_MAX) return NG;
v_strcpy(strno -1, xmenu.item[reginum]);
svar_set(strno, xmenu.item[reginum]);
return OK;
}
@@ -78,6 +78,6 @@ int spxm_titlereg(void) {
}
int spxm_titleget(int strno) {
v_strcpy(strno -1, xmenu.title);
svar_set(strno, xmenu.title);
return OK;
}
+5 -5
View File
@@ -45,7 +45,7 @@ static void ExchangeString(void) {
int target = getCaliValue();
int pat = getCaliValue();
int patr = getCaliValue();
v_strReplaceAll(target - 1, pat - 1, patr - 1);
svar_replaceAll(target, pat, patr);
DEBUG_COMMAND("ShString.ExchangeString: %d,%d,%d:\n", target, pat, patr);
}
@@ -89,7 +89,7 @@ static void SetWindowTitle(void) { /* 6 */
int strno = getCaliValue();
int p2 = getCaliValue(); /* ISys3xSystem */
ags_setWindowTitle(v_str(strno - 1));
ags_setWindowTitle(svar_get(strno));
DEBUG_COMMAND("ShString.SetWindowTitle: %d,%d:\n", strno, p2);
}
@@ -109,8 +109,8 @@ static void FillString() {
int i;
for (i = 0; i < cnt; i++) {
if (st - 1 != src)
v_strcpy(st -1, v_str(src));
if (st + i != src)
svar_set(st + i, svar_get(src));
}
DEBUG_COMMAND("ShString.FillString: %d,%d,%d,%d:\n", st, cnt, src, p4);
@@ -126,7 +126,7 @@ static void SetStringNum16(void) {
*/
int st = getCaliValue();
int *var = getCaliVariable();
const char *str = v_str(st -1);
const char *str = svar_get(st);
char _dst[100];
char *dst = _dst;
+6 -13
View File
@@ -29,7 +29,6 @@
#include "system.h"
#include "nact.h"
#include "ags.h"
#include "font.h"
#include "surface.h"
#include "ngraph.h"
@@ -59,13 +58,10 @@ int dt_setfont(int type, int size) {
* @return: 実際に描画した幅
*/
int dt_drawtext(surface_t *sf, int x, int y, char *buf) {
agsurface_t *glyph;
int sx, sy, sw, sh;
FONT *font = nact->ags.font;
font->sel_font(ftype, fsize);
glyph = font->get_glyph(buf);
ags_setFont(ftype, fsize);
agsurface_t *glyph = ags_drawStringToSurface(buf);
if (glyph == NULL) return 0;
sx = x; sy = y;
@@ -92,13 +88,10 @@ int dt_drawtext(surface_t *sf, int x, int y, char *buf) {
* @return: 実際に描画した幅
*/
int dt_drawtext_col(surface_t *sf, int x, int y, char *buf, int r, int g, int b) {
agsurface_t *glyph;
int sx, sy, sw, sh;
FONT *font = nact->ags.font;
font->sel_font(ftype, fsize);
glyph = font->get_glyph(buf);
ags_setFont(ftype, fsize);
agsurface_t *glyph = ags_drawStringToSurface(buf);
if (glyph == NULL) return 0;
sx = x; sy = y;
+8 -12
View File
@@ -13,14 +13,12 @@ static surface_t *create(int width, int height, int depth, boolean has_pixel, bo
s->width = width;
s->height = height;
s->has_alpha = has_alpha;
s->has_pixel = has_pixel;
s->bytes_per_line = width;
s->bytes_per_pixel = 1;
s->depth = depth;
if (s->has_pixel) {
if (has_pixel) {
switch (s->depth) {
case 8:
s->pixel = calloc(width * (height +1), sizeof(BYTE));
@@ -42,11 +40,9 @@ static surface_t *create(int width, int height, int depth, boolean has_pixel, bo
default:
WARNING("depth %d is not supported\n", s->depth);
}
} else {
s->pixel = NULL;
}
if (s->has_alpha) {
if (has_alpha) {
s->alpha = calloc(width * (height +1), sizeof(BYTE));
}
@@ -111,13 +107,13 @@ surface_t *sf_dup(surface_t *in) {
sf = malloc(sizeof(surface_t));
memcpy(sf, in, sizeof(surface_t));
if (in->has_pixel) {
if (in->pixel) {
len = sf->bytes_per_line * sf->height;
sf->pixel = malloc(sizeof(BYTE) * (len + sf->bytes_per_line));
memcpy(sf->pixel, in->pixel, len);
}
if (in->has_alpha) {
if (in->alpha) {
len = sf->width * sf->height;
sf->alpha = malloc(sizeof(BYTE) * (len + sf->width));
memcpy(sf->alpha, in->alpha, len);
@@ -143,12 +139,12 @@ void sf_copyall(surface_t *dst, surface_t *src) {
if (src->bytes_per_pixel != dst->bytes_per_pixel) return;
if (src->has_alpha && dst->has_alpha) {
if (src->alpha && dst->alpha) {
len = src->width * src->height;
memcpy(dst->alpha, src->alpha, len);
}
if (src->has_pixel && dst->has_pixel) {
if (src->pixel && dst->pixel) {
len = src->bytes_per_line * src->height;
memcpy(dst->pixel, src->pixel, len);
}
@@ -170,7 +166,7 @@ surface_t *sf_dup2(surface_t *in, boolean copypixel, boolean copyalpha) {
sf = malloc(sizeof(surface_t));
memcpy(sf, in, sizeof(surface_t));
if (in->has_pixel) {
if (in->pixel) {
len = sf->bytes_per_line * sf->height;
sf->pixel = malloc(sizeof(BYTE) * (len + sf->bytes_per_line));
if (copypixel) {
@@ -178,7 +174,7 @@ surface_t *sf_dup2(surface_t *in, boolean copypixel, boolean copyalpha) {
}
}
if (in->has_alpha) {
if (in->alpha) {
len = sf->width * sf->height;
sf->alpha = malloc(sizeof(BYTE) * (len + sf->width));
if (copyalpha) {
+11 -5
View File
@@ -40,7 +40,9 @@ target_sources(xsystem35 PRIVATE
pms.c vsp.c bmp.c qnt.c)
if (HAVE_JPEG)
target_sources(xsystem35 PRIVATE jpeg.c)
target_link_libraries(xsystem35 PRIVATE JPEG::JPEG)
if (NOT EMSCRIPTEN)
target_link_libraries(xsystem35 PRIVATE JPEG::JPEG)
endif()
endif()
# Music
@@ -70,7 +72,11 @@ endif()
if (EMSCRIPTEN)
set(LIBS "SHELL:-s USE_ZLIB=1 -s USE_FREETYPE=1 -s USE_SDL=2")
set(LIBS
"SHELL:-s USE_ZLIB=1"
"SHELL:-s USE_LIBJPEG=1"
"SHELL:-s USE_FREETYPE=1"
"SHELL:-s USE_SDL=2")
target_compile_options(xsystem35 PRIVATE ${LIBS})
target_link_options(xsystem35 PRIVATE ${LIBS})
target_link_libraries(xsystem35 PRIVATE idbfs.js)
@@ -85,7 +91,7 @@ if (EMSCRIPTEN)
"SHELL:-s ALLOW_MEMORY_GROWTH=1"
"SHELL:-s NO_EXIT_RUNTIME=1"
"SHELL:-s EXPORTED_FUNCTIONS=\"['_main','_ags_setAntialiasedStringMode', '_ald_getdata', '_ald_freedata']\""
"SHELL:-s EXTRA_EXPORTED_RUNTIME_METHODS=\"['getValue','getMemory','addRunDependency','removeRunDependency']\"")
"SHELL:-s EXTRA_EXPORTED_RUNTIME_METHODS=\"['getValue','addRunDependency','removeRunDependency']\"")
elseif (ANDROID)
@@ -131,7 +137,7 @@ endif()
# FIXME: set up dependency for xsystem35 on this
if (ENABLE_SDL AND NOT EMSCRIPTEN AND NOT ANDROID)
add_custom_target(sdl_input.c
COMMAND perl xsyskey.pl ${SDL2_INCLUDE_DIRS} > sdl_input.c
add_custom_target(sdl_keytable.h
COMMAND perl ../tools/xsyskey.pl ${SDL2_INCLUDE_DIRS} > sdl_keytable.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()
+32 -24
View File
@@ -45,15 +45,15 @@
#define check_param_xy ags_check_param_xy
#define intersection ags_intersection
static void initPal(Pallet256 *sys_pal);
static void initPal(Palette256 *sys_pal);
static boolean intersects(MyRectangle *r1, MyRectangle *r2);
static Pallet256 pal_256;
static Palette256 pal_256;
static boolean need_update = TRUE;
static boolean fade_outed = FALSE;
static int cursor_move_time = 50; /* カーソル移動にかかる時間(ms) */
static void initPal(Pallet256 *pal) {
static void initPal(Palette256 *pal) {
int i;
for (i = 0; i < 256; i++) {
pal->red[i] = 0; pal->green[i] = 0; pal->blue[i] = 0;
@@ -62,7 +62,7 @@ static void initPal(Pallet256 *pal) {
pal->red[7] = 255; pal->green[7] = 255; pal->blue[7] = 255;
pal->red[15] = 255; pal->green[15] = 255; pal->blue[15] = 255;
pal->red[255] = 255; pal->green[255] = 255; pal->blue[255] = 255;
SetPallet(pal, 0, 256);
SetPalette(pal, 0, 256);
nact->sys_pal_changed = TRUE;
}
@@ -155,20 +155,19 @@ void ags_setWorldSize(int width, int height, int depth) {
nact->sys_world_size.width = width;
nact->sys_world_size.height = height;
nact->sys_world_depth = depth;
if (nact->ags.dib && nact->ags.dib->alpha) {
free(nact->ags.dib->alpha);
nact->ags.dib->alpha = NULL;
}
SetWorldSize(width, height, depth);
nact->ags.dib = GetDIB();
nact->ags.dib->has_alpha = FALSE;
nact->ags.dib->has_pixel = TRUE;
/* DIBが8以上の場合は、alpha plane を用意 */
if (depth > 8) {
if (nact->ags.dib->alpha != NULL) {
free(nact->ags.dib->alpha);
}
if (depth > 8)
nact->ags.dib->alpha = calloc(width * height, sizeof(BYTE));
nact->ags.dib->has_alpha = TRUE;
}
fade_outed = FALSE; /* thanx tajiri@wizard */
@@ -186,16 +185,16 @@ void ags_setViewArea(int x, int y, int width, int height) {
void ags_setWindowTitle(const char *src) {
#define TITLEHEAD "XSystem35 Version "VERSION":"
BYTE *dst, *d;
BYTE *utf, *d;
dst = sjis2utf(src);
if (NULL == (d = malloc(strlen(dst) + strlen(TITLEHEAD) + 1))) {
utf = toUTF8(src);
if (NULL == (d = malloc(strlen(utf) + strlen(TITLEHEAD) + 1))) {
NOMEMERR();
}
strcpy(d, TITLEHEAD);
strcat(d, dst);
strcat(d, utf);
SetWindowTitle(d);
free(dst);
free(utf);
free(d);
}
@@ -251,7 +250,7 @@ void ags_updateFull() {
}
}
void ags_setPallets(Pallet256 *src_pal, int src, int dst, int cnt) {
void ags_setPalettes(Palette256 *src_pal, int src, int dst, int cnt) {
int i;
for (i = 0; i < cnt; i++) {
nact->sys_pal->red [dst + i] = src_pal->red [src + i];
@@ -261,16 +260,16 @@ void ags_setPallets(Pallet256 *src_pal, int src, int dst, int cnt) {
nact->sys_pal_changed = TRUE;
}
void ags_setPallet(int no, int red, int green, int blue) {
void ags_setPalette(int no, int red, int green, int blue) {
nact->sys_pal->red[no] = red;
nact->sys_pal->green[no] = green;
nact->sys_pal->blue[no] = blue;
nact->sys_pal_changed = TRUE;
}
void ags_setPalletToSystem(int src, int cnt) {
void ags_setPaletteToSystem(int src, int cnt) {
if (!fade_outed)
SetPallet(nact->sys_pal, src, cnt);
SetPalette(nact->sys_pal, src, cnt);
}
void ags_drawRectangle(int x, int y, int w, int h, int col) {
@@ -324,7 +323,7 @@ void ags_wrapColor(int x, int y, int w, int h, int p1, int p2) {
WrapColor(x, y, w, h, p1, p2);
}
void ags_getPixel(int x, int y, Pallet *cell) {
void ags_getPixel(int x, int y, Palette *cell) {
if (!check_param_xy(&x, &y)) return;
DspDeviceSync();
@@ -402,11 +401,20 @@ int ags_drawString(int x, int y, const char *src, int col) {
if (!check_param_xy(&x, &y)) return 0;
DspDeviceSync();
w = DrawString(x, y, src, col);
char *utf8 = toUTF8(src);
w = DrawString(x, y, utf8, col);
free(utf8);
return w;
}
agsurface_t *ags_drawStringToSurface(const char *str) {
char *utf8 = toUTF8(str);
agsurface_t *sf = nact->ags.font->get_glyph(utf8);
free(utf8);
return sf;
}
void ags_drawCg8bit(cgdata *cg, int x, int y) {
int sx, sy, w, h;
+21 -16
View File
@@ -29,8 +29,8 @@
#include "portab.h"
#include "cg.h"
#include "graphics.h"
#include "font.h"
struct _FONT;
/* マウスカーソルの種類 */
#define CURSOR_ARROW 1
@@ -62,8 +62,6 @@ typedef enum {
} ALPHA_DIB_COPY_TYPE;
struct agsurface {
int no; /* surface number, primary DIB is 0 */
int width; /* width of surface */
int height; /* height of surface */
int depth; /* depth of surface, 8/15/16/24/32 is available */
@@ -71,12 +69,8 @@ struct agsurface {
int bytes_per_line; /* bytes per line */
int bytes_per_pixel; /* bytes per pixel */
BYTE *pixel; /* pointer to pixel data */
BYTE *alpha; /* pointer to alpha pixel data */
boolean has_alpha;
boolean has_pixel;
BYTE *pixel; /* pixel data (can be NULL) */
BYTE *alpha; /* alpha pixel data (can be NULL) */
};
typedef struct agsurface agsurface_t;
@@ -118,8 +112,8 @@ typedef struct ags_faderinfo ags_faderinfo_t;
struct _ags {
Pallet256 pal; /* system pallet */
boolean pal_changed; /* system pallet has changed */
Palette256 pal; /* system palette */
boolean pal_changed; /* system palette has changed */
MyDimension world_size; /* size of off-screen */
@@ -136,7 +130,7 @@ struct _ags {
boolean fullscree_is_on; /* if full-screen mode then true */
FONT *font; /* font device */
struct _FONT *font; /* font device */
agsurface_t *dib; /* main surface */
void (*eventcb)(agsevent_t *e); /* deliver event */
};
@@ -169,9 +163,9 @@ extern void ags_updateFull(void);
extern void ags_updateArea(int x, int y, int width, int height);
/* パレット関係 */
extern void ags_setPallets(Pallet256 *src_pal, int src, int dst, int cnt);
extern void ags_setPallet(int no, int red, int green, int blue);
extern void ags_setPalletToSystem(int src, int cnt);
extern void ags_setPalettes(Palette256 *src_pal, int src, int dst, int cnt);
extern void ags_setPalette(int no, int red, int green, int blue);
extern void ags_setPaletteToSystem(int src, int cnt);
/* 描画関係 */
extern void ags_drawRectangle(int x, int y, int w, int h, int col);
@@ -185,7 +179,7 @@ extern void ags_copyAreaSP(int sx, int sy, int w, int h, int dx, int dy, int col
extern void ags_copyArea_shadow_withrate(int sx, int sy, int w, int h, int dx, int dy, int lv);
extern void ags_wrapColor(int x, int y, int w, int h, int p1, int p2);
extern void ags_getPixel(int x, int y, Pallet *cell);
extern void ags_getPixel(int x, int y, Palette *cell);
extern void ags_changeColorArea(int x, int y, int w, int h, int dst, int src, int cnt);
extern void* ags_saveRegion(int x, int y, int w, int h);
@@ -224,7 +218,18 @@ extern void ags_whiteOut(int rate, boolean flg);
extern void ags_fader_callback();
/* フォント関連 */
typedef enum {
FONT_X11,
FONT_FT2,
FONT_SDLTTF
} fontdev_t;
enum FontType {
FONT_GOTHIC,
FONT_MINCHO,
};
extern void ags_setFont(int type, int size);
extern agsurface_t *ags_drawStringToSurface(const char *str);
/* カーソル関係 */
extern void ags_setCursorType(int type);
+8 -29
View File
@@ -36,7 +36,7 @@
* static methods
*/
static bmp_header *extract_header(BYTE *b);
static void getpal(Pallet256 *pal, BYTE *b);
static void getpal(Palette256 *pal, BYTE *b);
static void extract_8bit(bmp_header *bmp, BYTE *pic, BYTE *b);
static void extract_24bit(bmp_header *bmp, WORD *pic, BYTE *b);
@@ -64,11 +64,11 @@ static bmp_header *extract_header(BYTE *b) {
}
/*
* Get pallet from raw data
* pal: pallet to be stored
* b : raw data (pointer to pallet)
* Get palette from raw data
* pal: palette to be stored
* b : raw data (pointer to palette)
*/
static void getpal(Pallet256 *pal, BYTE *b) {
static void getpal(Palette256 *pal, BYTE *b) {
int i;
for (i = 0; i < 256; i++) {
@@ -160,7 +160,7 @@ boolean bmp256_checkfmt(BYTE *data) {
}
/*
* Extract 8bit bmp, header, pallet and pixel
* Extract 8bit bmp, header, palette and pixel
* data: raw data (pointer to data top)
* return: extracted image data and information
*/
@@ -168,7 +168,7 @@ cgdata *bmp256_extract(BYTE *data) {
bmp_header *bmp = extract_header(data);
cgdata *cg = calloc(1, sizeof(cgdata));
cg->pal = malloc(sizeof(Pallet256));
cg->pal = malloc(sizeof(Palette256));
getpal(cg->pal, data + bmp->bmpPp);
/* +10: margin for broken cg */
@@ -208,7 +208,7 @@ boolean bmp16m_checkfmt(BYTE *data) {
}
/*
* Extract 24bit bmp, header, pallet and pixel
* Extract 24bit bmp, header, palette and pixel
* data: raw data (pointer to data top)
* return: extracted image data and information
*/
@@ -232,24 +232,3 @@ cgdata *bmp16m_extract(BYTE *data) {
return cg;
}
/*
* Extract bmp pallet only
* data: raw data (pointer to data top)
* return: extracted pallet data
*/
cgdata *bmp_getpal(BYTE *data) {
cgdata *cg = calloc(1, sizeof(cgdata));
bmp_header *bmp = extract_header(data);
cg->pal = malloc(sizeof(Pallet256));
getpal(cg->pal, data + bmp->bmpPp);
cg->type = ALCG_BMP8;
cg->pic = NULL;
cg->alpha = NULL;
free(bmp);
return cg;
}
-1
View File
@@ -50,6 +50,5 @@ extern boolean bmp256_checkfmt(BYTE *data);
extern cgdata *bmp256_extract(BYTE *data);
extern boolean bmp16m_checkfmt(BYTE *data);
extern cgdata *bmp16m_extract(BYTE *data);
extern cgdata *bmp_getpal(BYTE *data);
#endif /* !__BMP__ */
+3 -6
View File
@@ -208,7 +208,7 @@ int cdrom_getPlayingInfo (cd_time *info) {
struct cd_sub_channel_info data;
if (!enabled)
goto errexit;
return NG;
memset(&s, 0, sizeof(s));
s.data = &data;
@@ -217,17 +217,14 @@ int cdrom_getPlayingInfo (cd_time *info) {
s.data_format = CD_CURRENT_POSITION;
if (do_ioctl(CDIOCREADSUBCHANNEL, &s) < 0) {
perror("CDIOCREADSUBCHANNEL");
goto errexit;
return NG;
}
if (s.data->header.audio_status != CD_AS_PLAY_IN_PROGRESS) {
goto errexit;
return NG;
}
info->t = s.data->what.position.track_number;
info->m = s.data->what.position.reladdr.msf.minute;
info->s = s.data->what.position.reladdr.msf.second;
info->f = s.data->what.position.reladdr.msf.frame;
return OK;
errexit:
info->t = info->m = info->s = info->f = 999;
return NG;
}
+3 -6
View File
@@ -241,22 +241,19 @@ static int cdrom_getPlayingInfo (cd_time *info) {
struct cdrom_subchnl sc;
if (!enabled)
goto errexit;
return NG;
sc.cdsc_format = CDROM_MSF;
if (do_ioctl(CDROMSUBCHNL, &sc) < 0) {
perror("CDROMSUBCHNL");
goto errexit;
return NG;
}
if (sc.cdsc_audiostatus != CDROM_AUDIO_PLAY) {
goto errexit;
return NG;
}
info->t = sc.cdsc_trk;
info->m = sc.cdsc_reladdr.msf.minute;
info->s = sc.cdsc_reladdr.msf.second;
info->f = sc.cdsc_reladdr.msf.frame;
return OK;
errexit:
info->t = info->m = info->s = info->f = 999;
return NG;
}
-1
View File
@@ -59,6 +59,5 @@ int cdrom_stop() {
}
int cdrom_getPlayingInfo (cd_time *info) {
info->t = info->m = info->s = info->f = 999;
return NG;
}
+2
View File
@@ -69,6 +69,8 @@ int cdrom_getPlayingInfo(cd_time *info) {
frame_of_getpos = nact->frame_count;
int t = EM_ASM_INT_V( return xsystem35.cdPlayer.getPosition(); );
if (!t)
return NG;
info->t = t & 0xff;
FRAMES_TO_MSF(t >> 8, &info->m, &info->s, &info->f);
return OK;
+4 -11
View File
@@ -198,18 +198,15 @@ static int cdrom_stop() {
/* 現在演奏中のトラック情報の取得 */
static int cdrom_getPlayingInfo (cd_time *inf) {
int cnt;
if (!enabled || !mix_music) {
goto errout;
}
if (!enabled || !mix_music)
return NG;
if (!Mix_PlayingMusic()) {
Mix_FreeMusic(mix_music);
mix_music = NULL;
goto errout;
return NG;
}
cnt = get_high_counter(SYSTEMCOUNTER_MP3) - counter;
int cnt = get_high_counter(SYSTEMCOUNTER_MP3) - counter;
inf->t = trackno;
inf->m = cnt / (60*100); cnt %= (60*100);
@@ -217,8 +214,4 @@ static int cdrom_getPlayingInfo (cd_time *inf) {
inf->f = (cnt * CD_FPS) / 100;
return OK;
errout:
inf->t = inf->m = inf->s = inf->f = 999;
return NG;
}
+56 -84
View File
@@ -42,7 +42,7 @@
/* VSPのパレット展開バンク */
int cg_vspPB = -1;
/* cg,pallet 展開フラグ (funciotn flag) */
/* cg,palette 展開フラグ (funciotn flag) */
int cg_fflg = 7;
/* CGをロードした回数を書き込む変数 */
int *cg_loadCountVar = NULL;
@@ -50,8 +50,8 @@ int *cg_loadCountVar = NULL;
int cg_alphaLevel = 255;
#define GCMD_EXTRACTCG(c) ((c) & 0x01)
#define GCMD_SET_PALLET(c) ((c) & 0x02)
#define GCMD_LOAD_PALLET(c) ((c) & 0x04)
#define GCMD_SET_PALETTE(c) ((c) & 0x02)
#define GCMD_LOAD_PALETTE(c) ((c) & 0x04)
/* CG表示位置に関する情報 */
static CG_WHERETODISP loc_policy = OFFSET_NOMOVE, loc_policy0;
@@ -98,9 +98,9 @@ static CG_TYPE check_cgformat(BYTE *data) {
}
/*
* Modify pixel accoding to pallet bank (vsp only)
* Modify pixel accoding to palette bank (vsp only)
* pic : pixel to be modifyied.
* bank : pallet bank (use only MSB 4bit)
* bank : palette bank (use only MSB 4bit)
* width : image width
* height: image height
*/
@@ -225,63 +225,43 @@ static cgdata *loader(int no) {
/* extract cg */
/* size is only pixel data size */
if (GCMD_EXTRACTCG(cg_fflg)) {
switch(type) {
case ALCG_VSP:
cg = vsp_extract(dfile->data);
size = cg->width * cg->height;
break;
case ALCG_PMS8:
cg = pms256_extract(dfile->data);
size = cg->width * cg->height;
break;
case ALCG_PMS16:
cg = pms64k_extract(dfile->data);
size = (cg->width * cg->height) * sizeof(WORD);
break;
case ALCG_BMP8:
cg = bmp256_extract(dfile->data);
size = cg->width * cg->height;
break;
case ALCG_BMP24:
cg = bmp16m_extract(dfile->data);
size = (cg->width * cg->height) * sizeof(WORD);
break;
case ALCG_QNT:
cg = qnt_extract(dfile->data);
size = (cg->width * cg->height) * 3;
break;
switch(type) {
case ALCG_VSP:
cg = vsp_extract(dfile->data);
size = cg->width * cg->height;
break;
case ALCG_PMS8:
cg = pms256_extract(dfile->data);
size = cg->width * cg->height;
break;
case ALCG_PMS16:
cg = pms64k_extract(dfile->data);
size = (cg->width * cg->height) * sizeof(WORD);
break;
case ALCG_BMP8:
cg = bmp256_extract(dfile->data);
size = cg->width * cg->height;
break;
case ALCG_BMP24:
cg = bmp16m_extract(dfile->data);
size = (cg->width * cg->height) * sizeof(WORD);
break;
case ALCG_QNT:
cg = qnt_extract(dfile->data);
size = (cg->width * cg->height) * 3;
break;
#ifdef HAVE_JPEG
case ALCG_JPEG:
cg = jpeg_extract(dfile->data, dfile->size);
size = (cg->width * cg->height) * sizeof(WORD);
break;
case ALCG_JPEG:
cg = jpeg_extract(dfile->data, dfile->size);
size = (cg->width * cg->height) * sizeof(WORD);
break;
#endif
default:
break;
}
/* insert to cache */
if (cg)
cache_insert(cacheid, no, cg, size, NULL);
}
/* load pallet if not extracted */
if (GCMD_LOAD_PALLET(cg_fflg) && cg == NULL) {
/* XXXX うむ、こいつらどこで解放するんだ */
switch(type) {
case ALCG_VSP:
cg = vsp_getpal(dfile->data);
break;
case ALCG_PMS8:
cg = pms_getpal(dfile->data);
break;
case ALCG_BMP8:
cg = bmp_getpal(dfile->data);
break;
default:
break;
}
default:
break;
}
/* insert to cache */
if (cg)
cache_insert(cacheid, no, cg, size, NULL);
/* ok to free */
ald_freedata(dfile);
@@ -335,7 +315,7 @@ void cg_load(int no, int flg) {
if (GCMD_EXTRACTCG(cg_fflg) && cg->type == ALCG_VSP) {
bank = cg_vspPB == -1 ? cg->vsp_bank : cg_vspPB;
set_vspbank(cg->pic, bank << 4, cg->width, cg->height);
/* copy pallets 0 -> bank */
/* copy palettes 0 -> bank */
{
int i, i_dst = bank << 4;
for (i = 0; i < 16; i++) {
@@ -349,43 +329,39 @@ void cg_load(int no, int flg) {
}
}
/* copy pallet to system */
if (GCMD_LOAD_PALLET(cg_fflg)) {
/* copy palette to system */
if (GCMD_LOAD_PALETTE(cg_fflg)) {
switch(cg->type) {
case ALCG_VSP:
ags_setPallets(cg->pal, 0, bank << 4, 16);
ags_setPalettes(cg->pal, 0, bank << 4, 16);
break;
case ALCG_PMS8:
if (cg->pms_bank & 1)
ags_setPallets(cg->pal, 10, 10, 6);
ags_setPalettes(cg->pal, 10, 10, 6);
if (cg->pms_bank & (1 << 15))
//ags_setPallets(cg->pal, 240, 240, 15);
ags_setPallets(cg->pal, 240, 240, 10);
//ags_setPalettes(cg->pal, 240, 240, 15);
ags_setPalettes(cg->pal, 240, 240, 10);
for (i = 1; i < 15; i++) {
if (cg->pms_bank & (1 << i)) {
ags_setPallets(cg->pal, i * 16, i * 16, 16);
ags_setPalettes(cg->pal, i * 16, i * 16, 16);
}
}
break;
case ALCG_BMP8:
ags_setPallets(cg->pal, 10, 10, 236);
ags_setPalettes(cg->pal, 10, 10, 236);
break;
default:
break;
}
/* pallet load only */
if (cg->pic == NULL) {
cgdata_free(cg);
}
}
/* refrect pallet change */
if (GCMD_SET_PALLET(cg_fflg)) {
/* refrect palette change */
if (GCMD_SET_PALETTE(cg_fflg)) {
switch(cg->type) {
case ALCG_VSP:
case ALCG_PMS8:
case ALCG_BMP8:
ags_setPalletToSystem(0, 256);
ags_setPaletteToSystem(0, 256);
break;
default:
break;
@@ -505,15 +481,15 @@ int cg_load_with_filename(char *fname_utf8, int x, int y) {
return status;
}
/* load pallet if not extracted */
if (GCMD_LOAD_PALLET(cg_fflg)) {
/* load palette if not extracted */
if (GCMD_LOAD_PALETTE(cg_fflg)) {
if (cg->type == ALCG_BMP8)
ags_setPallets(cg->pal, 10, 10, 236);
ags_setPalettes(cg->pal, 10, 10, 236);
}
if (GCMD_SET_PALLET(cg_fflg)) {
if (GCMD_SET_PALETTE(cg_fflg)) {
if (cg->type == ALCG_BMP8)
ags_setPalletToSystem(0, 256);
ags_setPaletteToSystem(0, 256);
}
/* draw cg */
@@ -551,10 +527,6 @@ void cg_get_info(int no, MyRectangle *info) {
}
}
cgdata *cg_loadonly(int no) {
return loader(no);
}
void cg_clear_display_loc() {
clear_display_loc();
}
+13 -14
View File
@@ -45,23 +45,23 @@ typedef enum {
* information for display cg data
*/
typedef struct {
CG_TYPE type; /* cg format type */
int x; /* default display location x */
int y; /* default display location y */
int width; /* image width */
int height; /* image height */
CG_TYPE type; // cg format type
int x; // default display location x
int y; // default display location y
int width; // image width
int height; // image height
BYTE *pic; /* extracted pixel data */
BYTE *alpha; /* extracted alpha data if exists */
Pallet256 *pal; /* extracted pallet data if exists */
BYTE *pic; // extracted pixel data
BYTE *alpha; // extracted alpha data if exists
Palette256 *pal; // extracted palette data if exists
int vsp_bank; /* pallet bank for vsp */
int pms_bank; /* pallet bank for pms */
int vsp_bank; // palette bank for vsp
int pms_bank; // palette bank for pms
int spritecolor; /* sprite color for vsp and pms8 */
int alphalevel; /* alpha level of image */
int spritecolor; // sprite color for vsp and pms8
int alphalevel; // alpha level of image
int data_offset; /* pic offset for clipping */
int data_offset; // pic offset for clipping
} cgdata;
/*
@@ -81,7 +81,6 @@ extern void cg_load(int no, int flg);
extern void cg_load_with_alpha(int cgno, int shadowno);
extern int cg_load_with_filename(char *fname_utf8, int x, int y);
extern void cg_get_info(int no, MyRectangle *info);
extern cgdata *cg_loadonly(int no);
extern void cg_clear_display_loc();
extern int cg_vspPB;
+30 -36
View File
@@ -367,7 +367,7 @@ void commands2F23() {
int y = getCaliValue();
char *vFileName = sys_getString(0);
char *fname_utf8 = sjis2utf(vFileName);
char *fname_utf8 = toUTF8(vFileName);
sysVar[0] = cg_load_with_filename(fname_utf8, x, y);
free(fname_utf8);
@@ -380,7 +380,7 @@ void commands2F24() {
int *var = NULL, _var = 0;
int num = 0;
char *fname_utf8 = sjis2utf(file_name);
char *fname_utf8 = toUTF8(file_name);
switch(type) {
case 0:
var = getCaliVariable();
@@ -412,8 +412,8 @@ void commands2F26() {
char *title = sys_getString(0);
char *t1, *t2, *t3;
t1 = sjis2utf(title);
t2 = sjis2utf(v_str(dst_no -1));
t1 = toUTF8(title);
t2 = toUTF8(svar_get(dst_no));
mi_param.title = t1;
mi_param.oldstring = t2;
@@ -421,17 +421,15 @@ void commands2F26() {
menu_inputstring(&mi_param);
if (mi_param.newstring == NULL) {
v_strcpy(dst_no -1, NULL);
svar_set(dst_no, NULL);
free(t1); free(t2);
return;
}
t3 = utf2sjis(mi_param.newstring);
t3 = fromUTF8(mi_param.newstring);
/* 全角文字以外は不可 */
if (!sjis_has_hankaku(t3)) {
v_strcpy(dst_no -1, t3);
}
svar_set(dst_no, t3);
free(t1);
free(t2);
free(t3);
@@ -444,7 +442,7 @@ void commands2F27() {
char *string = sys_getString(0);
if (num > 0) {
v_strcpy(num - 1, string);
svar_set(num, string);
} else {
WARNING("MS: num <= 0\n");
}
@@ -457,7 +455,7 @@ void commands2F28() {
if (nact->game_title_utf8)
free(nact->game_title_utf8);
nact->game_title_utf8 = sjis2utf(title);
nact->game_title_utf8 = toUTF8(title);
ags_setWindowTitle(title);
@@ -478,7 +476,7 @@ void commands2F29() {
if (ni_param.title != NULL) {
free(ni_param.title);
}
t = sjis2utf(title);
t = toUTF8(title);
ni_param.title = t;
DEBUG_COMMAND("NT(new) %s:\n", title);
@@ -489,7 +487,7 @@ void commands2F2A() {
char *file_name = sys_getString(0);
int *var, _var = 0, cnt;
char *fname_utf8 = sjis2utf(file_name);
char *fname_utf8 = toUTF8(file_name);
switch(type) {
case 0:
var = getCaliVariable();
@@ -652,7 +650,7 @@ void commands2F3C() {
int ePos = getCaliValue();
int *vResult = getCaliVariable();
*vResult = v_strGetCharType(eNum - 1, ePos);
*vResult = svar_getCharType(eNum, ePos);
DEBUG_COMMAND("strGetCharType %d, %d, %d:\n", eNum, ePos, *vResult);
}
@@ -661,7 +659,7 @@ void commands2F3D() {
int eNum = getCaliValue();
int *vResult = getCaliVariable();
*vResult = v_strWidth(eNum -1);
*vResult = svar_width(eNum);
DEBUG_COMMAND("strGetLengthASCII %d, %d:\n", eNum, *vResult);
}
@@ -746,7 +744,7 @@ void commands2F44() {
int num2 = getCaliValue();
char buf[256];
v_strcpy(num1 - 1, format_number(num2, fig, buf));
svar_set(num1, format_number(num2, fig, buf));
DEBUG_COMMAND("MHH %d, %d, %d:\n", num1, fig, num2);
}
@@ -874,7 +872,7 @@ void commands2F52() {
const char *s = CMAKE_SYSTEM_NAME;
#endif
v_strcpy(eNum -1, s);
svar_set(eNum, s);
DEBUG_COMMAND("sysGetOsName %d: %s\n", eNum, s);
}
@@ -924,8 +922,8 @@ void commands2F57() {
char *t1, *t2, *t3;
INPUTSTRING_PARAM p;
t1 = sjis2utf(sTitle);
t2 = sjis2utf(v_str(eStrVar -1));
t1 = toUTF8(sTitle);
t2 = toUTF8(svar_get(eStrVar));
p.title = t1;
p.oldstring = t2;
p.max = eLength;
@@ -934,13 +932,9 @@ void commands2F57() {
if (p.newstring == NULL) {
*vResult = 65535;
} else {
t3 = utf2sjis(p.newstring);
if (!sjis_has_hankaku(t3)) {
v_strcpy(eStrVar -1, t3);
*vResult = sjis_count_char(t3);
} else {
*vResult = 65535;
}
t3 = fromUTF8(p.newstring);
svar_set(eStrVar, t3);
*vResult = svar_length(eStrVar);
free(t3);
}
free(t1);
@@ -953,7 +947,7 @@ void commands2F58() {
int eNum = getCaliValue();
int *vResult = getCaliVariable();
*vResult = sjis_has_hankaku(v_str(eNum - 1)) ? 1 : 0;
*vResult = sjis_has_hankaku(svar_get(eNum)) ? 1 : 0;
DEBUG_COMMAND("strCheckASCII %d, %d:\n", eNum, *vResult);
}
@@ -962,7 +956,7 @@ void commands2F59() {
int eNum = getCaliValue();
int *vResult = getCaliVariable();
*vResult = sjis_has_zenkaku(v_str(eNum - 1)) ? 1 : 0;
*vResult = sjis_has_zenkaku(svar_get(eNum)) ? 1 : 0;
DEBUG_COMMAND("strCheckSJIS %d, %d:\n", eNum, *vResult);
}
@@ -971,7 +965,7 @@ void commands2F5A() {
char *sText = sys_getString(0);
char *t1;
t1 = sjis2utf(sText);
t1 = toUTF8(sText);
menu_msgbox_open(t1);
free(t1);
@@ -982,7 +976,7 @@ void commands2F5B() {
int eNum = getCaliValue();
char *t1;
t1 = sjis2utf(v_str(eNum) - 1);
t1 = toUTF8(svar_get(eNum));
menu_msgbox_open(t1);
free(t1);
@@ -1148,7 +1142,7 @@ void commands2F67() {
int i;
for (i = 0; i < nact->ain.fncnum; i++) {
if (0 == strcmp(nact->ain.fnc[i].name, v_str(eStrNum -1))) {
if (0 == strcmp(nact->ain.fnc[i].name, svar_get(eStrNum))) {
fnctbl[eNum].page = nact->ain.fnc[i].page;
fnctbl[eNum].index = nact->ain.fnc[i].index;
break;
@@ -1297,7 +1291,7 @@ void commands2F77() {
int eStrNum = getCaliValue();
int eSelectNum = getCaliValue();
v_strcpy(eStrNum -1, sel_gettext(eSelectNum));
svar_set(eStrNum, sel_gettext(eSelectNum));
DEBUG_COMMAND("menuGetText %d,%d:\n", eStrNum, eSelectNum);
}
@@ -1356,9 +1350,9 @@ void commands2F7F() {
int index = sys_getdw();
int p1 = sys_getCaliValue();
sys_addMsg(v_str(p1 -1));
sys_addMsg(svar_get(p1));
DEBUG_COMMAND("2F7F %d, %d(%s,%s):\n", index, p1, nact->ain.msg[index], v_str(p1 -1));
DEBUG_COMMAND("2F7F %d, %d(%s,%s):\n", index, p1, nact->ain.msg[index], svar_get(p1));
}
void commands2F80() {
@@ -1398,7 +1392,7 @@ void commands2F82() {
DEBUG_COMMAND("dataGetString %d,%d:\n", eStrNum, eNumof);
for (i = 0; i < eNumof; i++) {
v_strcpy(eStrNum + i -1, p);
svar_set(eStrNum + i, p);
p += (strlen(p) + 1);
}
+3 -1
View File
@@ -1044,7 +1044,7 @@ void check_command(int c0) {
case 'X':
{
int num=getCaliValue();
sys_addMsg(v_str(num - 1));
sys_addMsg(svar_get(num));
DEBUG_COMMAND("X %d:\n", num);
}
break;
@@ -1098,6 +1098,8 @@ void check_command(int c0) {
undeferr();
}
break;
case 'U':
commandZU(); break;
case 'Z':
switch(sl_getc()) {
case 0:
+1
View File
@@ -304,6 +304,7 @@ extern void commandZI();
extern void commandZA();
extern void commandZK();
extern void commandZR();
extern void commandZU();
/* define in cmd2F.c */
extern void commands2F00();
+1 -1
View File
@@ -87,7 +87,7 @@ static void commandF1() {
p += (strlen(p) + 1);
}
v_strcpy(str_number - 1 , p);
svar_set(str_number, p);
p += (strlen(p) + 1);
nact->datatbl_addr = (void *)p;
}
+5 -1
View File
@@ -22,9 +22,11 @@
/* $Id: cmdh.c,v 1.5 2000/09/10 10:39:48 chikama Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "portab.h"
#include "xsystem35.h"
#include "utfsjis.h"
#include "hankaku.h"
void commandH() {
@@ -32,7 +34,9 @@ void commandH() {
int num = getCaliValue();
char buf[512];
sys_addMsg(format_number_zenkaku(num, fig, buf));
char *s = fromSJIS(format_number_zenkaku(num, fig, buf));
sys_addMsg(s);
free(s);
DEBUG_COMMAND("H %d,%d:\n",fig,num);
}
+2 -2
View File
@@ -112,7 +112,7 @@ void commandLE() {
int *var, _var = 0;
int num;
char *fname_utf8 = sjis2utf(filename);
char *fname_utf8 = toUTF8(filename);
switch(type) {
case 0: /* T2 */
var = getCaliVariable();
@@ -246,7 +246,7 @@ void commandLC() {
int y = getCaliValue();
char *filename = sys_getString(':');
char *fname_utf8 = sjis2utf(filename);
char *fname_utf8 = toUTF8(filename);
sysVar[0] = cg_load_with_filename(fname_utf8, x, y);
free(fname_utf8);
+38 -36
View File
@@ -51,7 +51,7 @@ void commandMS() {
char *str = sys_getString(':');
if (num > 0) { /* thanx tajiri@wizard */
v_strcpy(num - 1, str);
svar_set(num, str);
} else {
WARNING("MS: num(%d) <= 0\n", num);
}
@@ -62,34 +62,37 @@ void commandMP() {
/* 指定の文字列を指定文字数だけ表示する(Xコマンドの桁数指定) */
int num1 = getCaliValue();
int num2 = getCaliValue();
const char bstr[3] = "\x81\x40"; // full-width whitespace
const char *src = v_str(num1 - 1);
const char *fullwidth_blank[CHARACTER_ENCODING_MAX + 1] = {
[SHIFT_JIS] = "\x81\x40",
[UTF8] = " ",
};
const char *src = svar_get(num1);
int chars = num2;
char *str;
/* Patched English executable appends num2 spaces instead of truncating */
if (have_eng_mp_patch) {
str = calloc(strlen(src) + num2 * 2 + 1, 1);
str = calloc(strlen(src) + num2 * strlen(fullwidth_blank[nact->encoding]) + 1, 1);
if (NULL == str) {
NOMEMERR();
}
strcpy(str, src);
}
else {
str = calloc(num2 * 2 + 1, 1);
str = calloc(num2 * MAX_BYTES_PAR_CHAR(nact->encoding) + 1, 1);
if (NULL == str) {
NOMEMERR();
}
const char *p = src;
while (*p && chars > 0) {
p += CHECKSJIS1BYTE(*p) ? 2 : 1;
p = advance_char(p, nact->encoding);
chars--;
}
strncpy(str, src, p - src);
}
while (chars-- > 0) {
strcat(str, bstr);
strcat(str, fullwidth_blank[nact->encoding]);
}
sys_addMsg(str);
@@ -105,8 +108,8 @@ void commandMI() { /* T2 */
char *title = sys_getString(':');
char *t1, *t2, *t3;
t1 = sjis2utf(title);
t2 = sjis2utf(v_str(dst_no -1));
t1 = toUTF8(title);
t2 = toUTF8(svar_get(dst_no));
mi_param.title = t1;
mi_param.oldstring = t2;
@@ -114,17 +117,15 @@ void commandMI() { /* T2 */
menu_inputstring(&mi_param);
if (mi_param.newstring == NULL) {
v_strcpy(dst_no -1, NULL);
svar_set(dst_no, NULL);
free(t1); free(t2);
return;
}
t3 = utf2sjis(mi_param.newstring);
t3 = fromUTF8(mi_param.newstring);
/* 全角文字以外は不可 */
if (!sjis_has_hankaku(t3)) {
v_strcpy(dst_no -1, t3);
}
svar_set(dst_no, t3);
free(t1);
free(t2);
free(t3);
@@ -137,11 +138,11 @@ void commandMA() {
int num2 = getCaliValue();
if (num1 == num2) {
char *buf = strdup(v_str(num2 - 1));
v_strcat(num1 - 1, buf);
char *buf = strdup(svar_get(num2));
svar_append(num1, buf);
free(buf);
} else {
v_strcat(num1 - 1, v_str(num2 - 1));
svar_append(num1, svar_get(num2));
}
DEBUG_COMMAND("MA %d,%d:\n",num1,num2);
@@ -152,7 +153,7 @@ void commandMC() {
int num1 = getCaliValue();
int num2 = getCaliValue();
sysVar[0] = strcmp(v_str(num1 - 1), v_str(num2 - 1)) == 0 ? 1 : 0;
sysVar[0] = strcmp(svar_get(num1), svar_get(num2)) == 0 ? 1 : 0;
DEBUG_COMMAND("MC %d,%d:\n",num1,num2);
}
@@ -163,7 +164,7 @@ void commandMT() {
if (nact->game_title_utf8)
free(nact->game_title_utf8);
nact->game_title_utf8 = sjis2utf(str);
nact->game_title_utf8 = toUTF8(str);
ags_setWindowTitle(str);
/* 闘神都市II 対策 */
@@ -185,7 +186,7 @@ void commandMM() {
int num2 = getCaliValue();
if (num1 != num2)
v_strcpy(num1 - 1, v_str(num2 - 1));
svar_set(num1, svar_get(num2));
DEBUG_COMMAND("MM %d,%d:\n",num1, num2);
}
@@ -197,7 +198,9 @@ void commandMH() {
int num2 = getCaliValue();
char buf[512];
v_strcpy(num1 - 1, format_number_zenkaku(num2, fig, buf));
char *s = fromSJIS(format_number_zenkaku(num2, fig, buf));
svar_set(num1, s);
free(s);
DEBUG_COMMAND("MH %d,%d,%d:\n",num1,fig,num2);
}
@@ -215,7 +218,7 @@ void commandML() {
int *var = getCaliVariable();
int str_no = getCaliValue();
*var = sjis_count_char(v_str(str_no -1));
*var = svar_length(str_no);
DEBUG_COMMAND("ML %p,%d:\n",var, str_no);
}
@@ -226,7 +229,7 @@ void commandMD() {
int src_str_no = getCaliValue();
int len = getCaliValue();
v_strncpy(dst_str_no - 1, 0, src_str_no - 1, 0, len);
svar_copy(dst_str_no, 0, src_str_no, 0, len);
DEBUG_COMMAND("MD %d,%d,%d:\n",dst_str_no, src_str_no, len);
}
@@ -239,7 +242,7 @@ void commandME() {
int src_pos = getCaliValue();
int len = getCaliValue();
v_strncpy(dst_str_no - 1, dst_pos, src_str_no - 1, src_pos, len);
svar_copy(dst_str_no, dst_pos, src_str_no, src_pos, len);
DEBUG_COMMAND("ME %d,%d,%d,%d,%d:\n",dst_str_no, dst_pos, src_str_no, src_pos, len);
}
@@ -251,7 +254,7 @@ void commandMF() {
int key_no = getCaliValue();
int start_pos = getCaliValue();
int pos = v_strstr(dst_no - 1, start_pos, v_str(key_no - 1));
int pos = svar_find(dst_no, start_pos, svar_get(key_no));
if (pos < 0) {
sysVar[0] = 255;
@@ -274,7 +277,7 @@ void commandMZ0() {
/* いつからか、文字列変数の最大長さは∞になったようだ */
if (max_len == 0) max_len = STRVAR_LEN * 2;
v_initStringVars(max_num,max_len * 2 + 1);
svar_init(max_num, max_len * 2 + 1);
}
void commandMG() {
@@ -301,7 +304,7 @@ void commandMG() {
case 4:
sw = getCaliValue();
nact->msg.mg_curStrVarNo = nact->msg.mg_startStrVarNo + sw;
v_strcpy(nact->msg.mg_curStrVarNo -1, "");
svar_set(nact->msg.mg_curStrVarNo, "");
break;
case 5:
var = getCaliVariable();
@@ -313,7 +316,7 @@ void commandMG() {
break;
case 7:
var = getCaliVariable();
*var = v_strlen(nact->msg.mg_curStrVarNo -1);
*var = svar_length(nact->msg.mg_curStrVarNo);
break;
case 100:
sw = getCaliValue();
@@ -338,7 +341,7 @@ void commandMJ() {
INPUTSTRING_PARAM mj_param;
char *t1, *t2;
t1 = sjis2utf(v_str(num -1));
t1 = toUTF8(svar_get(num));
mj_param.max = max_len;
mj_param.x = x;
mj_param.y = y;
@@ -349,10 +352,9 @@ void commandMJ() {
menu_inputstring2(&mj_param);
if (mj_param.newstring == NULL) return;
t2 = utf2sjis(mj_param.newstring);
if (!sjis_has_hankaku(t2)) {
v_strcpy(num -1, t2);
}
t2 = fromUTF8(mj_param.newstring);
svar_set(num, t2);
free(t1);
free(t2);
DEBUG_COMMAND("MJ %d,%d,%d,%d,%d:\n", num, x, y, h, max_len);
@@ -368,11 +370,11 @@ void commandMN() {
switch(no) {
case 0:
/* 文字列を配列に変換する */
sysVar[0] = v_strToVars(num - 1, var);
sysVar[0] = svar_toVars(num, var);
break;
case 1:
/* 配列を文字列に変換する */
v_strFromVars(num - 1, var);
svar_fromVars(num, var);
break;
default:
WARNING("UnKnown MN command(%d)\n", no);
+5 -6
View File
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "portab.h"
#include "utfsjis.h"
@@ -359,6 +360,8 @@ void commandNI() { /* From Panyo */
ni_param.def = def;
ni_param.max = _max;
ni_param.min = _min;
if (!ni_param.title)
ni_param.title = strdup("");
menu_inputnumber(&ni_param);
@@ -375,13 +378,9 @@ void commandNI() { /* From Panyo */
void commandNT() { /* From Panyo */
/* NIコマンドで表示するタイトルを設定する。*/
char *str = sys_getString(':');
char *t;
if (ni_param.title != NULL) {
free(ni_param.title);
}
t = sjis2utf(str);
ni_param.title = t;
free(ni_param.title);
ni_param.title = toUTF8(str);
DEBUG_COMMAND("NT %p:\n", str);
}
+7 -7
View File
@@ -98,8 +98,8 @@ void commandPS() {
Green = getCaliValue();
Blue = getCaliValue();
ags_setPallet(Plane , Red, Green, Blue);
ags_setPalletToSystem(Plane, 1);
ags_setPalette(Plane, Red, Green, Blue);
ags_setPaletteToSystem(Plane, 1);
DEBUG_COMMAND("PS %d,%d,%d,%d:\n", Plane, Red, Green, Blue);
}
@@ -126,9 +126,9 @@ void commandPP() { /* T2 */
int i;
for (i = 0; i < num2; i++) {
ags_setPallet(num1 + i, *var, *(var +1), *(var +2)); var+=3;
ags_setPalette(num1 + i, *var, *(var +1), *(var +2)); var+=3;
}
ags_setPalletToSystem(num1, num2);
ags_setPaletteToSystem(num1, num2);
DEBUG_COMMAND("PP %p,%d,%d:\n", var, num1, num2);
}
@@ -155,7 +155,7 @@ void commandPT0() {
int *var = getCaliVariable();
int x = getCaliValue();
int y = getCaliValue();
Pallet cell;
Palette cell;
ags_getPixel(x, y, &cell);
*var = cell.pixel;
@@ -170,7 +170,7 @@ void commandPT1() {
int *b_var = getCaliVariable();
int x = getCaliValue();
int y = getCaliValue();
Pallet cell;
Palette cell;
ags_getPixel(x, y, &cell);
*r_var = cell.r;
@@ -186,7 +186,7 @@ void commandPT2() {
int *low_var = getCaliVariable();
int x = getCaliValue();
int y = getCaliValue();
Pallet cell;
Palette cell;
int r, g, b, pic;
ags_getPixel(x, y, &cell);
+1 -1
View File
@@ -87,7 +87,7 @@ void commandQE() {
char *filename = sys_getString(':');
int *var, _var = 0, cnt;
char *fname_utf8 = sjis2utf(filename);
char *fname_utf8 = toUTF8(filename);
switch(type) {
case 0:
var = getCaliVariable();
+14 -13
View File
@@ -56,17 +56,19 @@ void commandSS() {
void commandSC() {
/* CDのプレイ中のタイムを取得する */
int *var = getCaliVariable();
cd_time info;
int t, m, s, f;
mus_cdrom_get_playposition(&info);
if (info.t == 999) {
*var++ = 999;
if (mus_cdrom_get_playposition(&t, &m, &s, &f) == OK) {
*var++ = t - 1;
*var++ = m;
*var++ = s;
*var++ = f;
} else {
*var++ = info.t - 1;
*var++ = 999;
*var++ = 999;
*var++ = 999;
*var++ = 999;
}
*var++ = info.m;
*var++ = info.s;
*var++ = info.f;
DEBUG_COMMAND("SC %p:\n",var);
}
@@ -98,12 +100,11 @@ void commandSR() {
var = getCaliVariable();
if (num == 0) {
cd_time info;
mus_cdrom_get_playposition(&info);
if (info.t == 999) {
*var = 0;
int t, m, s, f;
if (mus_cdrom_get_playposition(&t, &m, &s, &f) == OK) {
*var = t - 1;
} else {
*var = info.t - 1;
*var = 0;
}
} else {
midiplaystate st;
+14 -3
View File
@@ -35,6 +35,7 @@
#include "message.h"
#include "input.h"
#include "nact.h"
#include "font.h"
void commandZC() {
/* システムの使用環境を変更する */
@@ -166,7 +167,7 @@ void commandZD() {
break;
case 2:
sw = getCaliValue();
DEBUG_MESSAGE("(ZD2)%s\n", v_str(sw -1));
DEBUG_MESSAGE("(ZD2)%s\n", svar_get(sw));
break;
case 3:
sw = getCaliValue(); break;
@@ -351,7 +352,7 @@ void commandZZ2() {
#else
static BYTE str[] = {0x82, 0x74, 0x82, 0x8e, 0x82, 0x8b, 0x82, 0x8e, 0x82, 0x8f, 0x82, 0x97, 0x82, 0x8e, 0};
#endif
v_strcpy(num -1, str);
svar_set(num, str);
DEBUG_COMMAND("ZZ2 %d:\n",num);
}
@@ -458,7 +459,7 @@ void commandZZ14() {
#endif
if (no <= 0) return;
v_strcpy(no -1, s);
svar_set(no, s);
DEBUG_COMMAND("ZZ14 %d:\n", no);
}
@@ -524,3 +525,13 @@ void commandZR() {
DEBUG_COMMAND("ZR %d,%d:\n", num, *var);
}
void commandZU() {
/* xsystem35 extension: sets unicode mode */
int sw = getCaliValue();
if (sw <= CHARACTER_ENCODING_MAX)
sys_setCharacterEncoding(sw);
DEBUG_COMMAND("ZU %d:\n",sw);
}
+2 -1
View File
@@ -228,9 +228,10 @@ static int read_bitmapinfo(BYTE* data) {
static int read_rgbquad(BYTE* data) {
int j;
int colors=2;
const int colors=2;
BYTE* p = data;
free(cursorImage.icColors);
cursorImage.icColors = malloc(sizeof(TRGBQuad) * colors);
if (cursorImage.icColors == NULL) { /* shouldn't happen */
+2 -13
View File
@@ -30,10 +30,6 @@
/* font の種類 */
#define FONTTYPEMAX 2
/* fontの名前 */
#define FONT_GOTHIC (0)
#define FONT_MINCHO (1)
struct agsurface;
struct _FONT {
@@ -45,9 +41,9 @@ struct _FONT {
void (*sel_font)(int type, int size);
struct agsurface *(*get_glyph)(const unsigned char *str);
struct agsurface *(*get_glyph)(const char *str_utf8);
int (*draw_glyph)(int x, int y, const unsigned char *str, int col);
int (*draw_glyph)(int x, int y, const char *str_utf8, int col);
boolean (*self_drawable)();
};
@@ -71,13 +67,6 @@ extern FONT *font_x11_new();
/* デフォルトのフォント名 */
#define FONT_DEFAULTNAME_X "-*-*-medium-r-normal--%d-*-*-*-c-*-jisx0208.1983-0,-*-*-medium-r-normal--%d-*-*-*-c-*-jisx0201.1976-0,*"
// Font devices
typedef enum {
FONT_X11,
FONT_FT2,
FONT_SDLTTF
} fontdev_t;
#ifdef __EMSCRIPTEN__
int load_mincho_font(void);
#endif
+11 -21
View File
@@ -34,6 +34,7 @@
#include "system.h"
#include "font.h"
#include "ags.h"
#include "utfsjis.h"
extern const unsigned short *s2u[];
@@ -59,20 +60,6 @@ static FONT *this;
static void pixmap2comimg(BYTE *src, int x, int y, int w, int h, int src_bpl);
static void pixmapmono2comimg(BYTE *src, int x, int y, int w, int h, int src_bpl);
static int toUnicode(const unsigned char **msg) {
int code;
if (**msg >= 0xa0 && **msg <= 0xdf) {
code = 0xff60 + (**msg) - 0xa0; (*msg)++;
} else if (**msg&0x80) {
code = s2u[**msg - 0x80][*(*msg+1) - 0x40];
(*msg) += 2;
} else {
code = **msg; (*msg)++;
}
return code;
}
static boolean select_charmap(FT_Face f, int type) {
int i;
@@ -154,11 +141,15 @@ static void font_ttf_sel_font(int type, int size) {
}
static void pixmap2comimg(BYTE *src, int x, int y, int w, int h, int src_bpl) {
int yy;
if (x < 0) {
w += x;
src -= x;
x = 0;
}
BYTE *dst = GETOFFSET_PIXEL(&img_glyph, x, y);
if (w <= 0) return;
for (yy = 0; yy < h; yy++) {
for (int yy = 0; yy < h; yy++) {
memcpy(dst, src, w);
src += src_bpl;
dst += img_glyph.bytes_per_line;
@@ -197,21 +188,20 @@ static void clear_canvas(void) {
memset(img_glyph.pixel, 0, GLYPH_PIXMAP_WIDTH * GLYPH_PIXMAP_HEIGHT);
}
static agsurface_t *font_ttf_get_glyph(const unsigned char *_msg) {
static agsurface_t *font_ttf_get_glyph(const char *str_utf8) {
FT_GlyphSlot slot;
FT_UShort code;
FT_Error err;
FT_Pixel_Mode pixelmode;
FT_Int loadflag;
int x = 0;
const unsigned char *msg = _msg;
if (fontset == NULL) return &img_glyph;
clear_canvas();
while (*msg) {
code = toUnicode(&msg);
while (*str_utf8) {
code = utf8_next_codepoint(&str_utf8);
if (this->antialiase_on) {
loadflag = FT_LOAD_RENDER;
@@ -266,7 +256,7 @@ static agsurface_t *font_ttf_get_glyph(const unsigned char *_msg) {
return &img_glyph;
}
static int font_ttf_draw_glyph(int x, int y, const unsigned char *str, int col) {
static int font_ttf_draw_glyph(int x, int y, const char *str_utf8, int col) {
return 0;
}
+8 -17
View File
@@ -9,7 +9,6 @@
#include "system.h"
#include "font.h"
#include "sdl_private.h"
#include "utfsjis.h"
typedef struct {
int size;
@@ -69,7 +68,7 @@ static void font_sdlttf_sel_font(int type, int size) {
}
}
static agsurface_t *font_sdlttf_get_glyph(const unsigned char *msg) {
static agsurface_t *font_sdlttf_get_glyph(const char *str_utf8) {
static SDL_Surface *fs;
static agsurface_t result;
@@ -80,15 +79,12 @@ static agsurface_t *font_sdlttf_get_glyph(const unsigned char *msg) {
fs = NULL;
}
BYTE* conv = sjis2utf(msg);
SDL_Color color = {255, 255, 255, 0};
if (this->antialiase_on) {
fs = TTF_RenderUTF8_Shaded(fontset->id, conv, color, color);
fs = TTF_RenderUTF8_Shaded(fontset->id, str_utf8, color, color);
} else {
fs = TTF_RenderUTF8_Solid(fontset->id, conv, color);
fs = TTF_RenderUTF8_Solid(fontset->id, str_utf8, color);
}
free(conv);
if (!fs) {
WARNING("Text rendering failed: %s\n", TTF_GetError());
return NULL;
@@ -142,30 +138,27 @@ static void sdl_drawAntiAlias_8bpp(int dstx, int dsty, SDL_Surface *src, unsigne
SDL_UnlockSurface(sdl_dib);
}
static int font_sdlttf_draw_glyph(int x, int y, const unsigned char *str, int cl) {
static int font_sdlttf_draw_glyph(int x, int y, const char *str_utf8, int cl) {
SDL_Surface *fs;
SDL_Rect r_src, r_dst;
int w, h, maxy;
BYTE *conv;
if (!*str)
if (!*str_utf8)
return 0;
if (!fontset)
return 0;
conv = sjis2utf(str);
if (this->antialiase_on) {
fs = TTF_RenderUTF8_Blended(fontset->id, conv, sdl_col[cl]);
fs = TTF_RenderUTF8_Blended(fontset->id, str_utf8, sdl_col[cl]);
} else {
fs = TTF_RenderUTF8_Solid(fontset->id, conv, sdl_col[cl]);
fs = TTF_RenderUTF8_Solid(fontset->id, str_utf8, sdl_col[cl]);
}
if (!fs) {
WARNING("Text rendering failed: %s\n", TTF_GetError());
free(conv);
return 0;
}
TTF_SizeUTF8(fontset->id, conv, &w, &h);
TTF_SizeUTF8(fontset->id, str_utf8, &w, &h);
y = max(0, y - (TTF_FontAscent(fontset->id) - fontset->size * 0.9));
if (sdl_dib->format->BitsPerPixel == 8 && this->antialiase_on) {
@@ -177,8 +170,6 @@ static int font_sdlttf_draw_glyph(int x, int y, const unsigned char *str, int cl
}
SDL_FreeSurface(fs);
free(conv);
return w;
}
+9 -29
View File
@@ -36,7 +36,6 @@
#include "ags.h"
#include "xcore.h"
#include "xcore_private.h"
#include "utfsjis.h"
#include "antialiase.h"
/* fontset の為の情報 */
@@ -151,22 +150,13 @@ static agsurface_t *get_drawn_glyph(const char *str, int w) {
return dst;
}
static agsurface_t *font_x11_get_glyph(const unsigned char *str) {
agsurface_t *dst;
int w;
BYTE *conv;
static agsurface_t *font_x11_get_glyph(const char *str_utf8) {
int w = XmbTextEscapement(fontset, str_utf8, strlen(str_utf8));
/* convert string code from sjis to utf-8 */
conv = sjis2utf(str);
w = XmbTextEscapement(fontset, conv, strlen(conv));
if (w == 0) {
free(conv);
if (w == 0)
return NULL;
}
dst = get_drawn_glyph(conv, w);
agsurface_t *dst = get_drawn_glyph(str_utf8, w);
image_get_glyph(dst, &img_glyph);
if (this->antialiase_on) {
@@ -178,27 +168,17 @@ static agsurface_t *font_x11_get_glyph(const unsigned char *str) {
free(dst->pixel);
free(dst);
free(conv);
return &img_glyph;
}
static int font_x11_draw_glyph(int x, int y, const unsigned char *str, int col) {
int w;
BYTE *conv;
/* convert string code from sjis to utf-8 */
conv = sjis2utf(str);
w = XmbTextEscapement(fontset, conv, strlen(conv));
if (w == 0) {
free(conv);
static int font_x11_draw_glyph(int x, int y, const char *str_utf8, int col) {
int w = XmbTextEscapement(fontset, str_utf8, strlen(str_utf8));
if (w == 0)
return 0;
}
if (!x11_dibinfo->shared) {
/* 一度 Pixmap に書いてからイメージを取得してDIBへ */
agsurface_t *dst = get_drawn_glyph(conv, w);
agsurface_t *dst = get_drawn_glyph(str_utf8, w);
if (DIB_DEPTH == dib_depth_candidate) {
image_getGlyphImage(DIB, dst, x, y, PAL2PIC(col));
@@ -208,7 +188,7 @@ static int font_x11_draw_glyph(int x, int y, const unsigned char *str, int col)
free(dst);
} else {
Xcore_setForeground(col);
XmbDrawString(x11_display, x11_pixmap, fontset, x11_gc_pix, x, y + font_ascent, conv, strlen(conv));
XmbDrawString(x11_display, x11_pixmap, fontset, x11_gc_pix, x, y + font_ascent, str_utf8, strlen(str_utf8));
x11_needSync = TRUE;
}
return w;
+2 -2
View File
@@ -30,12 +30,12 @@ typedef struct {
BYTE red[256];
BYTE green[256];
BYTE blue[256];
} Pallet256;
} Palette256;
typedef struct {
BYTE r,g,b;
DWORD pixel;
} Pallet;
} Palette;
typedef struct {
int x;
+196 -2
View File
@@ -140,7 +140,7 @@ static const char zenkaku_digits[][3] = {
0x81,0x40,0x00, /* space */
};
BYTE *zen2han(const BYTE *src) {
static BYTE *zen2han_sjis(const BYTE *src) {
BYTE c0, c1;
char *dst, *_dst;
@@ -173,7 +173,201 @@ BYTE *zen2han(const BYTE *src) {
return _dst;
}
BYTE *han2zen(const BYTE *src) {
static char *zen2han_utf8(const char *src) {
char *dst, *_dst;
dst = _dst = malloc(strlen(src) + 1);
if (dst == NULL) {
fprintf(stderr, "zen2han(): Out of Memory (size %zu)", strlen(src) + 1);
return NULL;
}
const char *p = src;
while (*p) {
const char *prev = p;
switch (utf8_next_codepoint(&p)) {
case L'': *dst++ = '\''; break;
case L'': *dst++ = '"'; break;
case L' ': *dst++ = ' '; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, "ソ"); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': strcpy(dst, ""); dst += 3; break;
case L'': *dst++ = '!'; break;
case L'': *dst++ = '#'; break;
case L'': *dst++ = '$'; break;
case L'': *dst++ = '%'; break;
case L'': *dst++ = '&'; break;
case L'': *dst++ = '('; break;
case L'': *dst++ = ')'; break;
case L'': *dst++ = '*'; break;
case L'': *dst++ = '+'; break;
case L'': *dst++ = ','; break;
case L'': *dst++ = '-'; break;
case L'': *dst++ = '.'; break;
case L'': *dst++ = '/'; break;
case L'': *dst++ = '0'; break;
case L'': *dst++ = '1'; break;
case L'': *dst++ = '2'; break;
case L'': *dst++ = '3'; break;
case L'': *dst++ = '4'; break;
case L'': *dst++ = '5'; break;
case L'': *dst++ = '6'; break;
case L'': *dst++ = '7'; break;
case L'': *dst++ = '8'; break;
case L'': *dst++ = '9'; break;
case L'': *dst++ = ':'; break;
case L'': *dst++ = ';'; break;
case L'': *dst++ = '<'; break;
case L'': *dst++ = '='; break;
case L'': *dst++ = '>'; break;
case L'': *dst++ = '?'; break;
case L'': *dst++ = '@'; break;
case L'': *dst++ = 'A'; break;
case L'': *dst++ = 'B'; break;
case L'': *dst++ = 'C'; break;
case L'': *dst++ = 'D'; break;
case L'': *dst++ = 'E'; break;
case L'': *dst++ = 'F'; break;
case L'': *dst++ = 'G'; break;
case L'': *dst++ = 'H'; break;
case L'': *dst++ = 'I'; break;
case L'': *dst++ = 'J'; break;
case L'': *dst++ = 'K'; break;
case L'': *dst++ = 'L'; break;
case L'': *dst++ = 'M'; break;
case L'': *dst++ = 'N'; break;
case L'': *dst++ = 'O'; break;
case L'': *dst++ = 'P'; break;
case L'': *dst++ = 'Q'; break;
case L'': *dst++ = 'R'; break;
case L'': *dst++ = 'S'; break;
case L'': *dst++ = 'T'; break;
case L'': *dst++ = 'U'; break;
case L'': *dst++ = 'V'; break;
case L'': *dst++ = 'W'; break;
case L'': *dst++ = 'X'; break;
case L'': *dst++ = 'Y'; break;
case L'': *dst++ = 'Z'; break;
case L'': *dst++ = '['; break;
case L'': *dst++ = ']'; break;
case L'': *dst++ = '^'; break;
case L'_': *dst++ = '_'; break;
case L'': *dst++ = '`'; break;
case L'': *dst++ = 'a'; break;
case L'': *dst++ = 'b'; break;
case L'': *dst++ = 'c'; break;
case L'': *dst++ = 'd'; break;
case L'': *dst++ = 'e'; break;
case L'': *dst++ = 'f'; break;
case L'': *dst++ = 'g'; break;
case L'': *dst++ = 'h'; break;
case L'': *dst++ = 'i'; break;
case L'': *dst++ = 'j'; break;
case L'': *dst++ = 'k'; break;
case L'': *dst++ = 'l'; break;
case L'': *dst++ = 'm'; break;
case L'': *dst++ = 'n'; break;
case L'': *dst++ = 'o'; break;
case L'': *dst++ = 'p'; break;
case L'': *dst++ = 'q'; break;
case L'': *dst++ = 'r'; break;
case L'': *dst++ = 's'; break;
case L'': *dst++ = 't'; break;
case L'': *dst++ = 'u'; break;
case L'': *dst++ = 'v'; break;
case L'': *dst++ = 'w'; break;
case L'': *dst++ = 'x'; break;
case L'': *dst++ = 'y'; break;
case L'': *dst++ = 'z'; break;
case L'': *dst++ = '{'; break;
case L'': *dst++ = '|'; break;
case L'': *dst++ = '}'; break;
case L'': *dst++ = '~'; break;
case L'': *dst++ = '\\'; break;
default:
while (prev < p)
*dst++ = *prev++;
break;
}
}
*dst = 0;
return _dst;
}
BYTE *zen2han(const BYTE *src, CharacterEncoding enc) {
switch (enc) {
case SHIFT_JIS:
return zen2han_sjis(src);
case UTF8:
return zen2han_utf8(src);
default:
return (BYTE *)src;
}
}
BYTE *han2zen(const BYTE *src, CharacterEncoding enc) {
if (enc != SHIFT_JIS)
return (BYTE *)src; // Not implemented
BYTE c0;
BYTE *dst, *_dst;
dst = _dst = malloc(strlen(src) * 2 + 1);
+3 -2
View File
@@ -24,9 +24,10 @@
#define __HANKAKU_H__
#include "portab.h"
#include "utfsjis.h"
extern BYTE *zen2han(const BYTE *src);
extern BYTE *han2zen(const BYTE *src);
extern BYTE *zen2han(const BYTE *src, CharacterEncoding enc);
extern BYTE *han2zen(const BYTE *src, CharacterEncoding enc);
extern char *format_number(int n, int width, char *buf);
extern char *format_number_zenkaku(int n, int width, char *buf);
+4 -2
View File
@@ -52,9 +52,11 @@ static void zen2han_test(void) {
"ベペボポヮヰヱヴヵヶΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩα"
"βγδεζηθικλμνξοπρστυφχψω";
for (const Zen2hanTestCase *tc = testcases; tc->zen; tc++) {
ASSERT_STRCMP(sjis2utf(zen2han(utf2sjis(tc->zen))), tc->han);
ASSERT_STRCMP(sjis2utf(zen2han(utf2sjis(tc->zen), SHIFT_JIS)), tc->han);
ASSERT_STRCMP(zen2han(tc->zen, UTF8), tc->han);
}
ASSERT_STRCMP(sjis2utf(zen2han(utf2sjis(unconvertable))), unconvertable);
ASSERT_STRCMP(sjis2utf(zen2han(utf2sjis(unconvertable), SHIFT_JIS)), unconvertable);
ASSERT_STRCMP(zen2han(unconvertable, UTF8), unconvertable);
}
static void format_number_test(void) {
+1 -1
View File
@@ -906,7 +906,7 @@ void image_copy_to_alpha(agsurface_t *dib, int sx, int sy, int w, int h, int dx,
}
int image_index2pixel(int depth, int i) {
Pallet256 *pal = nact->sys_pal;
Palette256 *pal = nact->sys_pal;
switch(depth) {
case 8:
+1 -1
View File
@@ -49,7 +49,7 @@ int joy_open(void) {
name=SDL_JoystickName(js);
joy_axes = SDL_JoystickNumAxes(js);
joy_buttons = SDL_JoystickNumButtons(js);
SDL_JoystickEventState(ENABLE_SDL);
SDL_JoystickEventState(SDL_ENABLE);
printf("SDL joystick '%s' axes %d buttons %d\n",name,joy_axes,joy_buttons);
return 1;
}
-26
View File
@@ -168,32 +168,6 @@ void menu_init() {
menu_window_msgbox= create_window6();
}
void menu_widget_reinit(boolean reset_colortmap) {
static GdkColor col[256];
static GdkVisual* vis;
static GdkColormap* cm;
int i;
if (reset_colortmap) {
vis = gdk_visual_get_system();
cm = gdk_colormap_new(vis, TRUE);
}
if (vis == NULL) return;
if (vis->type != GDK_VISUAL_PSEUDO_COLOR) return;
for (i = 0; i < 256; i++) {
col[i].pixel = i;
col[i].red = nact->sys_pal->red[i] * 257;
col[i].green = nact->sys_pal->green[i] * 257;
col[i].blue = nact->sys_pal->blue[i] * 257;
}
gdk_colors_store(cm, col, 256);
gtk_widget_set_default_colormap(cm);
/* reconstruct widget */
menu_init();
}
void menu_gtkmainiteration() {
if (!menu_initilized) return;
+1 -1
View File
@@ -26,7 +26,7 @@
#include "portab.h"
/* 文字列入力のパラメータ */
typedef struct {
typedef struct inputstring_param {
char *title;
char *oldstring;
const char *newstring;
+113
View File
@@ -0,0 +1,113 @@
/*
* Copyright (C) 2020 <KichikuouChrome@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "config.h"
#include <SDL.h>
#include <jni.h>
#include "system.h"
#include "portab.h"
#include "menu.h"
#include "nact.h"
#define STRING "Ljava/lang/String;"
void menu_open(void) {
return;
}
void menu_quitmenu_open(void) {
return;
}
boolean menu_inputstring(INPUTSTRING_PARAM *p) {
static char buf[256];
JNIEnv *env = SDL_AndroidGetJNIEnv();
if ((*env)->PushLocalFrame(env, 16) < 0) {
WARNING("Failed to allocate JVM local references");
return FALSE;
}
jstring msg = (*env)->NewStringUTF(env, p->title);
jstring oldstring = (*env)->NewStringUTF(env, p->oldstring);
if (!msg || !oldstring) {
WARNING("Failed to allocate a string");
(*env)->PopLocalFrame(env, NULL);
return FALSE;
}
jobject context = SDL_AndroidGetActivity();
jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context),
"inputString", "(" STRING STRING "I)" STRING);
jstring newstring = (jstring)(*env)->CallObjectMethod(env, context, mid, msg, oldstring, p->max);
if (newstring) {
const char *newstr_utf8 = (*env)->GetStringUTFChars(env, newstring, NULL);
strcpy(buf, newstr_utf8);
(*env)->ReleaseStringUTFChars(env, newstring, newstr_utf8);
(*env)->PopLocalFrame(env, NULL);
p->newstring = buf;
return TRUE;
}
(*env)->PopLocalFrame(env, NULL);
p->newstring = p->oldstring;
return FALSE;
}
boolean menu_inputstring2(INPUTSTRING_PARAM *p) {
p->newstring = p->oldstring;
return TRUE;
}
boolean menu_inputnumber(INPUTNUM_PARAM *p) {
JNIEnv *env = SDL_AndroidGetJNIEnv();
if ((*env)->PushLocalFrame(env, 16) < 0) {
WARNING("Failed to allocate JVM local references");
return FALSE;
}
jstring msg = (*env)->NewStringUTF(env, p->title);
if (!msg) {
WARNING("Failed to allocate a string");
(*env)->PopLocalFrame(env, NULL);
return FALSE;
}
jobject context = SDL_AndroidGetActivity();
jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context),
"inputNumber", "(" STRING "III)I");
p->value = (*env)->CallIntMethod(env, context, mid, msg, p->min, p->max, p->def);
(*env)->PopLocalFrame(env, NULL);
return TRUE;
}
void menu_msgbox_open(char *msg) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION,
nact->game_title_utf8, msg, NULL);
}
void menu_init(void) {
return;
}
void menu_gtkmainiteration() {
return;
}
+6 -8
View File
@@ -57,22 +57,20 @@ boolean menu_inputstring2(INPUTSTRING_PARAM *p) {
}
boolean menu_inputnumber(INPUTNUM_PARAM *p) {
p->value = p->def;
p->value = EM_ASM_({
return xsystem35.shell.inputNumber(UTF8ToString($0), $1, $2, $3);
}, p->title, p->min, p->max, p->def);
return TRUE;
}
void menu_msgbox_open(char *msg) {
return;
}
EM_JS(void, menu_msgbox_open, (char *msg), {
window.alert(UTF8ToString(msg));
});
void menu_init(void) {
return;
}
void menu_widget_reinit(boolean reset_colortmap) {
return;
}
void menu_gtkmainiteration() {
return;
}
+2 -4
View File
@@ -25,6 +25,7 @@
#include <stdio.h>
#include "portab.h"
#include "nact.h"
#include "menu.h"
void menu_open(void) {
@@ -32,6 +33,7 @@ void menu_open(void) {
}
void menu_quitmenu_open(void) {
nact->is_quit = TRUE;
return;
}
@@ -58,10 +60,6 @@ void menu_init(void) {
return;
}
void menu_widget_reinit(boolean reset_colortmap) {
return;
}
void menu_gtkmainiteration() {
return;
}
+85
View File
@@ -0,0 +1,85 @@
/*
* menu_sdl.c popup menu for SDL
*
* Copyright (C) 2000- Masaki Chikama (Wren) <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
*
*/
#include "config.h"
#include <stdio.h>
#include "portab.h"
#include "system.h"
#include "nact.h"
#include "menu.h"
#include "sdl_core.h"
#include "sdl_private.h"
void menu_open(void) {
return;
}
void menu_quitmenu_open(void) {
const SDL_MessageBoxButtonData buttons[] = {
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "Quit" },
{ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, 0, "Cancel" },
};
const SDL_MessageBoxData messagebox_data = {
.flags = SDL_MESSAGEBOX_INFORMATION,
.window = sdl_window,
.title = "Confirm",
.message = "Quit xsystem35?",
.numbuttons = SDL_arraysize(buttons),
.buttons = buttons,
};
int buttonid = 0;
if (SDL_ShowMessageBox(&messagebox_data, &buttonid) < 0) {
WARNING("error displaying message box");
return;
}
if (buttonid == 1) {
nact->is_quit = TRUE;
nact->wait_vsync = TRUE;
}
}
boolean menu_inputstring(INPUTSTRING_PARAM *p) {
p->newstring = p->oldstring;
return TRUE;
}
boolean menu_inputstring2(INPUTSTRING_PARAM *p) {
return sdl_inputString(p);
}
boolean menu_inputnumber(INPUTNUM_PARAM *p) {
p->value = p->def;
return TRUE;
}
void menu_msgbox_open(char *msg) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, nact->game_title_utf8, msg, sdl_window);
}
void menu_init(void) {
return;
}
void menu_gtkmainiteration() {
return;
}
+17 -14
View File
@@ -263,10 +263,10 @@ void msg_openWindow(int W, int C1, int C2, int N, int M) {
case WINDOW_FRAME_EMPTY:
if (M == 0) {
/* show window */
if (msg.win->savedimg != NULL) {
ags_delRegion(msg.win->savedimg);
}
if (msg.win->save) {
if (msg.win->savedimg != NULL) {
ags_delRegion(msg.win->savedimg);
}
msg.win->savedimg = ags_saveRegion(msg.win->x, msg.win->y, msg.win->width, msg.win->height);
} else {
msg.win->savedimg = NULL;
@@ -283,10 +283,10 @@ void msg_openWindow(int W, int C1, int C2, int N, int M) {
case WINDOW_FRAME_LINE:
if (M == 0) {
/* show window*/
if (msg.win->savedimg != NULL) {
ags_delRegion(msg.win->savedimg);
}
if (msg.win->save) {
if (msg.win->savedimg != NULL) {
ags_delRegion(msg.win->savedimg);
}
msg.win->savedimg = ags_saveRegion(msg.win->x -8, msg.win->y -8, msg.win->width +16, msg.win->height +16);
} else {
msg.win->savedimg = NULL;
@@ -326,11 +326,14 @@ void msg_getMessageLocation(MyPoint *loc) {
void msg_hitAnyKey() {
int w;
static BYTE hak[] = {0x81, 0xa5, 0x00}; /* ▼ */
const char *prompt[CHARACTER_ENCODING_MAX + 1] = {
[SHIFT_JIS] = "\x81\xa5",
[UTF8] = "",
};
w = ags_drawString(msg.win->x + msg.win->width - msg.MsgFontSize,
msg.win->y + msg.win->height - msg.MsgFontSize,
hak, msg.HitAnyKeyMsgColor);
prompt[nact->encoding], msg.HitAnyKeyMsgColor);
ags_updateArea(msg.win->x + msg.win->width - msg.MsgFontSize,
msg.win->y + msg.win->height - msg.MsgFontSize,
w, msg.MsgFontSize);
@@ -349,17 +352,17 @@ static void drawLineFrame(Bcom_WindowInfo *i) {
}
static void copyMsgToStrVar(const char *m) {
if (v_strlen(msg.mg_curStrVarNo -1) == 0) {
v_strcpy(msg.mg_curStrVarNo -1, m);
if (svar_length(msg.mg_curStrVarNo) == 0) {
svar_set(msg.mg_curStrVarNo, m);
} else {
v_strcat(msg.mg_curStrVarNo -1, m);
svar_append(msg.mg_curStrVarNo, m);
}
}
static void msgget_at_r() {
if (msg.mg_policyR == 1) return;
msg.mg_curStrVarNo++;
// v_strcpy(msg.mg_curStrVarNo -1, NULL);
// svar_set(msg.mg_curStrVarNo, NULL);
}
static void msgget_at_a() {
@@ -369,10 +372,10 @@ static void msgget_at_a() {
break;
case 1:
msg.mg_curStrVarNo++;
v_strcpy(msg.mg_curStrVarNo -1, "");
svar_set(msg.mg_curStrVarNo, "");
break;
case 2:
v_strcpy(msg.mg_curStrVarNo -1, "");
svar_set(msg.mg_curStrVarNo, "");
msg.mg_curStrVarNo++;
break;
case 3:
-11
View File
@@ -54,8 +54,6 @@ mididevice_t midi = {
midi_fading
};
static int midino;
static int midi_initilize(char *pname, int subdev) {
return OK;
}
@@ -66,9 +64,6 @@ static int midi_exit() {
}
static int midi_start(int no, int loop, char *data, int datalen) {
if (midino == no)
return OK;
JNIEnv *env = SDL_AndroidGetJNIEnv();
if ((*env)->PushLocalFrame(env, 16) < 0) {
WARNING("Failed to allocate JVM local references");
@@ -99,7 +94,6 @@ static int midi_start(int no, int loop, char *data, int datalen) {
(*env)->CallVoidMethod(env, context, mid, path_str, loop == 0);
(*env)->PopLocalFrame(env, NULL);
midino = no;
return OK;
}
@@ -115,7 +109,6 @@ static int midi_stop() {
(*env)->CallVoidMethod(env, context, mid);
(*env)->PopLocalFrame(env, NULL);
midino = 0;
return OK;
}
@@ -129,10 +122,7 @@ static int midi_unpause(void) {
static int midi_get_playing_info(midiplaystate *st) {
st->in_play = FALSE;
st->play_no = 0;
st->loc_ms = 0;
if (midino == 0)
return OK;
JNIEnv *env = SDL_AndroidGetJNIEnv();
if ((*env)->PushLocalFrame(env, 16) < 0) {
@@ -147,7 +137,6 @@ static int midi_get_playing_info(midiplaystate *st) {
if (pos >= 0) {
st->in_play = TRUE;
st->play_no = midino;
st->loc_ms = pos;
}
return OK;
+5 -18
View File
@@ -55,8 +55,6 @@ mididevice_t midi = {
midi_fading
};
static int midino;
static int midi_initilize(char *pname, int subdev) {
return OK;
}
@@ -67,19 +65,12 @@ static int midi_exit() {
}
static int midi_start(int no, int loop, char *data, int datalen) {
if (midino == no)
return OK;
EM_ASM_ARGS({ xsystem35.midiPlayer.play($0, $1, $2); }, loop, data, datalen);
midino = no;
return OK;
}
static int midi_stop() {
EM_ASM( xsystem35.midiPlayer.stop(); );
midino = 0;
return OK;
}
@@ -94,17 +85,13 @@ EM_JS(int, midi_unpause, (void), {
});
static int midi_get_playing_info(midiplaystate *st) {
if (midino != 0) {
int pos = EM_ASM_INT_V( return xsystem35.midiPlayer.getPosition(); );
if (pos >= 0) {
st->in_play = TRUE;
st->play_no = midino;
st->loc_ms = pos;
return OK;
}
int pos = EM_ASM_INT_V( return xsystem35.midiPlayer.getPosition(); );
if (pos >= 0) {
st->in_play = TRUE;
st->loc_ms = pos;
return OK;
}
st->in_play = FALSE;
st->play_no = 0;
st->loc_ms = 0;
return OK;
}
+1 -7
View File
@@ -119,7 +119,6 @@ static boolean enabled = FALSE;
static struct midiinfo *midi;
static int midifd;
static char *mididevname;
static int midino;
static pid_t midipid;
static int counter;
@@ -536,7 +535,6 @@ static int midi_start(int no, int loop, char *data, int datalen) {
_exit(0);
}
midino = no;
midipid = pid;
counter = get_high_counter(SYSTEMCOUNTER_MIDI);
@@ -554,7 +552,6 @@ static int midi_stop() {
while(0 >= waitpid(midipid, &status, WNOHANG));
midipid = 0;
midino = 0;
return OK;
}
@@ -576,16 +573,14 @@ static int midi_unpause(void) {
static int midi_get_playing_info(midiplaystate *st) {
int status, cnt, err;
if (!enabled || midino == 0) {
if (!enabled || midipid == 0) {
st->in_play = FALSE;
st->play_no = 0;
st->loc_ms = 0;
return OK;
}
if (midipid == (err = waitpid(midipid, &status, WNOHANG))) {
st->in_play = FALSE;
st->play_no = 0;
st->loc_ms = 0;
midipid = 0;
return OK;
@@ -594,7 +589,6 @@ static int midi_get_playing_info(midiplaystate *st) {
cnt = get_high_counter(SYSTEMCOUNTER_MIDI) - counter;
st->in_play = TRUE;
st->play_no = midino;
st->loc_ms = cnt * 10;
return OK;
+1 -9
View File
@@ -63,7 +63,6 @@ mididevice_t midi = {
};
static Mix_Music *mix_music;
static int midino;
static int counter;
static uint32_t fade_tick;
@@ -80,9 +79,6 @@ static int midi_exit() {
}
static int midi_start(int no, int loop, char *data, int datalen) {
if (midino == no)
return OK;
midi_stop();
SDL_RWops *rwops = SDL_RWFromConstMem(data, datalen);
@@ -96,7 +92,6 @@ static int midi_start(int no, int loop, char *data, int datalen) {
return NG;
}
midino = no;
counter = get_high_counter(SYSTEMCOUNTER_MIDI);
return OK;
}
@@ -106,7 +101,6 @@ static int midi_stop() {
return OK;
Mix_FreeMusic(mix_music);
mix_music = NULL;
midino = 0;
return OK;
}
@@ -123,9 +117,8 @@ static int midi_unpause(void) {
}
static int midi_get_playing_info(midiplaystate *st) {
if (midino == 0) {
if (!mix_music) {
st->in_play = FALSE;
st->play_no = 0;
st->loc_ms = 0;
return OK;
}
@@ -133,7 +126,6 @@ static int midi_get_playing_info(midiplaystate *st) {
int cnt = get_high_counter(SYSTEMCOUNTER_MIDI) - counter;
st->in_play = TRUE;
st->play_no = midino;
st->loc_ms = cnt * 10;
return OK;
}
+10 -5
View File
@@ -67,13 +67,18 @@ int mus_cdrom_stop() {
}
/*
* cdrom
* info: (track/min/sec/frame)
* 999/999/999/999
* cdrom (track/min/sec/frame)
* NG
*/
int mus_cdrom_get_playposition(cd_time *tm) {
int mus_cdrom_get_playposition(int *t, int *m, int *s, int *f) {
if (!prv.cd_valid) return NG;
*tm = muscd_getpos();
cd_time info;
if (muscd_getpos(&info) != OK)
return NG;
*t = info.t;
*m = info.m;
*s = info.s;
*f = info.f;
return OK;
}
+1 -2
View File
@@ -25,7 +25,6 @@
#define __MUSIC_CLIENT_H__
#include "portab.h"
#include "cdrom.h"
#include "midi.h"
enum MixDevice {
@@ -42,7 +41,7 @@ extern int mus_exit();
/* cdrom related function */
extern int mus_cdrom_start(int track, int loop);
extern int mus_cdrom_stop(void);
extern int mus_cdrom_get_playposition(cd_time *tm);
extern int mus_cdrom_get_playposition(int *t, int *m, int *s, int *f);
extern int mus_cdrom_get_maxtrack(void);
extern boolean mus_cdrom_get_state(void);
+2 -4
View File
@@ -80,10 +80,8 @@ int muscd_stop() {
return OK;
}
cd_time muscd_getpos() {
cd_time tm;
prv.cddev.getpos(&tm);
return tm;
int muscd_getpos(cd_time *tm) {
return prv.cddev.getpos(tm);
}
int muscd_cb() {
+1 -1
View File
@@ -46,7 +46,7 @@ extern int muscd_init();
extern int muscd_exit();
extern int muscd_start(int trk, int loop);
extern int muscd_stop();
extern cd_time muscd_getpos();
extern int muscd_getpos(cd_time *tm);
extern int muscd_cb();
#endif /* __MUSIC_CDROM_H__ */
+17 -8
View File
@@ -29,6 +29,8 @@
#include "midi.h"
#include "ald_manager.h"
static int midino;
int musmidi_init() {
int st = midi_init(&prv.mididev);
@@ -51,17 +53,19 @@ int musmidi_exit() {
int musmidi_start(int no, int loop) {
if (!prv.midi_valid) return NG;
if (midino == no)
return OK;
dridata *dfile;
dfile = ald_getdata(DRIFILE_MIDI, no -1);
if (dfile == NULL) {
prv.midi.dfile = NULL;
dridata *dfile = ald_getdata(DRIFILE_MIDI, no -1);
if (dfile == NULL)
return NG;
}
prv.midi.dev->start(no, loop, dfile->data, dfile->size);
if (prv.midi.dfile)
ald_freedata(prv.midi.dfile);
prv.midi.dfile = dfile;
prv.midi.dev->start(no, loop, prv.midi.dfile->data, prv.midi.dfile->size);
midino = no;
return OK;
}
@@ -75,6 +79,7 @@ int musmidi_stop() {
ald_freedata(prv.midi.dfile);
prv.midi.dfile = NULL;
}
midino = 0;
return OK;
}
@@ -94,9 +99,13 @@ int musmidi_unpause() {
midiplaystate musmidi_getpos() {
midiplaystate st = {FALSE, 0, 0};
if (!prv.midi_valid) return st;
if (!prv.midi_valid || !midino) return st;
prv.midi.dev->getpos(&st);
if (st.in_play)
st.play_no = midino;
else
midino = 0;
return st;
}
+13 -7
View File
@@ -70,6 +70,10 @@ void sys_setHankakuMode(int mode) {
msg_msgHankakuMode = mode;
}
void sys_setCharacterEncoding(CharacterEncoding encoding) {
nact->encoding = encoding;
}
/* 文字列の取り出し */
char *sys_getString(char term) {
int c0;
@@ -103,9 +107,9 @@ void sys_addMsg(const char *str) {
switch(msg_msgHankakuMode) {
case 0:
msg = han2zen(str); break;
msg = han2zen(str, nact->encoding); break;
case 1:
msg = zen2han(str); break;
msg = zen2han(str, nact->encoding); break;
case 2:
msg = str; break;
default:
@@ -126,7 +130,7 @@ void sys_addMsg(const char *str) {
}
}
if (msg && msg_msgHankakuMode < 2) {
if (msg != str) {
free((char *)msg);
}
}
@@ -136,8 +140,10 @@ static int checkMessage() {
char *index = msgbuf;
int c0 = sl_getc();
while (c0 == 0x20 || c0 > 0x80) {
if (c0 == 0x20) {
while (c0 == 0x20 || c0 >= 0x80) {
if (nact->encoding == UTF8) {
*index++ = (char)c0;
} else if (c0 == 0x20) {
*index++ = (char)c0;
} else if (c0 >= 0xe0) {
*index++ = (char)c0; *index++ = (char)sl_getc();
@@ -173,10 +179,10 @@ void nact_main() {
nact->cmd_count++;
}
nact->callback();
#ifndef __EMSCRIPTEN__
if (!nact->is_message_locked)
sys_getInputInfo();
#endif
WaitVsync();
nact->frame_count++;
nact->wait_vsync = FALSE;
+9 -2
View File
@@ -27,12 +27,17 @@
#include "portab.h"
#include "graphics.h"
#include "scenario.h"
#include "font.h"
#include "s39ain.h"
#include "gameresource.h"
#include "selection.h"
#include "message.h"
#include "ags.h"
#include "utfsjis.h"
#define toUTF8(s) codeconv(UTF8, nact->encoding, s)
#define toSJIS(s) codeconv(SHIFT_JIS, nact->encoding, s)
#define fromUTF8(s) codeconv(nact->encoding, UTF8, s)
#define fromSJIS(s) codeconv(nact->encoding, SHIFT_JIS, s)
/* コマンド解析時に参照する */
#define sys_getc sl_getc
@@ -47,6 +52,7 @@ extern int *getVariable();
extern char *sys_getString(char term);
extern void sys_addMsg(const char *str);
extern void sys_setHankakuMode(int mode);
extern void sys_setCharacterEncoding(CharacterEncoding encoding);
extern char *sys_getConstString();
// extern boolean sys_nact_engine();
@@ -62,6 +68,7 @@ typedef struct {
boolean is_message_locked; /* pointer 等の event handler を呼び出さない */
boolean popupmenu_opened; /* popup menu が 開いているか */
boolean mmx_is_ok; /* MMX が有効かどうか */
CharacterEncoding encoding;
char *game_title_utf8;
int scenario_version;
@@ -73,7 +80,7 @@ typedef struct {
#if 1
/* ags info */
Pallet256 *sys_pal;
Palette256 *sys_pal;
boolean sys_pal_changed;
MyRectangle sys_view_area;
MyDimension sys_world_size;
+8 -29
View File
@@ -44,7 +44,7 @@
* static methods
*/
static pms_header *extract_header(BYTE *b);
static void getpal(Pallet256 *pal, BYTE *b);
static void getpal(Palette256 *pal, BYTE *b);
static void extract_8bit(pms_header *pms, BYTE *pic, BYTE *b);
static void extract_16bit(pms_header *pms, WORD *pic, BYTE *b);
@@ -74,11 +74,11 @@ static pms_header *extract_header(BYTE *b) {
}
/*
* Get pallet from raw data
* pal: pallet to be stored
* b : raw data (pointer to pallet)
* Get palette from raw data
* pal: palette to be stored
* b : raw data (pointer to palette)
*/
static void getpal(Pallet256 *pal, BYTE *b) {
static void getpal(Palette256 *pal, BYTE *b) {
int i;
for (i = 0; i < 256; i++) {
@@ -219,7 +219,7 @@ boolean pms256_checkfmt(BYTE *data) {
}
/*
* Extract 8bit pms, header, pallet and pixel
* Extract 8bit pms, header, palette and pixel
* data: raw data (pointer to data top)
* return: extracted image data and information
*/
@@ -227,7 +227,7 @@ cgdata *pms256_extract(BYTE *data) {
cgdata *cg = calloc(1, sizeof(cgdata));
pms_header *pms = extract_header(data);
cg->pal = malloc(sizeof(Pallet256));
cg->pal = malloc(sizeof(Palette256));
getpal(cg->pal, data + pms->pmsPp);
/* +10: margin for broken cg */
@@ -269,7 +269,7 @@ boolean pms64k_checkfmt(BYTE *data) {
}
/*
* Extract 16bit pms, header, pallet and pixel
* Extract 16bit pms, header, palette and pixel
* data: raw data (pointer to data top)
* return: extracted image data and information
*/
@@ -298,24 +298,3 @@ cgdata *pms64k_extract(BYTE *data) {
return cg;
}
/*
* Extract pms pallet only
* data: raw data (pointer to data top)
* return: extracted pallet data
*/
cgdata *pms_getpal(BYTE *data) {
cgdata *cg = calloc(1, sizeof(cgdata));
pms_header *pms = extract_header(data);
cg->pal = malloc(sizeof(Pallet256));
getpal(cg->pal, data + pms->pmsPp);
cg->type = ALCG_PMS8;
cg->pic = NULL;
cg->alpha = NULL;
free(pms);
return cg;
}
+4 -5
View File
@@ -34,13 +34,13 @@ typedef struct {
int pmsBpp; /* pms data depth, 8 or 16 */
int pmsBppS; /* shadow data depth, if exists */
int pmsSf; /* sprite flag (not used?) */
int pmsBf; /* pallet bank */
int pmsBf; /* palette bank */
int pmsX0; /* display location x */
int pmsY0; /* display location y */
int pmsXW; /* image width */
int pmsYW; /* image height */
int pmsDp; /* pointer to data */
int pmsPp; /* pointer to pallet or shadow */
int pmsPp; /* pointer to palette or shadow */
int pmsCp; /* pointer to comment */
} pms_header;
/*
@@ -49,12 +49,12 @@ typedef struct {
* pmsBppS shows shadow's depth (normally 8).
*
* pmsBf
* If pmsBpp is 8, pmsBf determine which pallets is used in this data and
* If pmsBpp is 8, pmsBf determine which palettes is used in this data and
* needed to copy. The pmsBf is mask and if bit is on then copy.
* For example, if pmsBf=0xff00, then copy pal[128] ~ pal[255].
*
* pmsPp
* If pmsBpp is 8 then this is pointer to pallet. If pmsBpp is 16 and
* If pmsBpp is 8 then this is pointer to palette. If pmsBpp is 16 and
* pmsPp is not 0, then shadow is exists and this is pointer to it's data.
*
*/
@@ -63,7 +63,6 @@ extern boolean pms256_checkfmt(BYTE *data);
extern cgdata *pms256_extract(BYTE *data);
extern boolean pms64k_checkfmt(BYTE *data);
extern cgdata *pms64k_extract(BYTE *data);
extern cgdata *pms_getpal(BYTE *data);
#endif /* !__PMS__ */
+14 -27
View File
@@ -46,26 +46,14 @@
*/
#define ZLIBBUF_MARGIN 5*1024
/*
static methods
*/
static qnt_header *extract_header(BYTE *b);
static void extract_pixel(qnt_header *qnt, BYTE *pic, BYTE *b);
static void extract_alpha(qnt_header *qnt, BYTE *pic, BYTE *b);
/*
Get information from header
b: raw data
return: acquired qnt information object
qnt: acquired qnt information object
*/
static qnt_header *extract_header(BYTE *b) {
qnt_header *qnt = malloc(sizeof(qnt_header));
int rsv0;
rsv0 = LittleEndian_getDW(b, 4);
static void extract_header(BYTE *b, qnt_header *qnt) {
int rsv0 = LittleEndian_getDW(b, 4);
if (rsv0 == 0) {
qnt->hdr_size = 48;
qnt->x0 = LittleEndian_getDW(b, 8);
@@ -87,8 +75,6 @@ static qnt_header *extract_header(BYTE *b) {
qnt->pixel_size = LittleEndian_getDW(b, 36);
qnt->alpha_size = LittleEndian_getDW(b, 40);
}
return qnt;
}
/*
@@ -242,21 +228,22 @@ boolean qnt_checkfmt(BYTE *data) {
*/
cgdata *qnt_extract(BYTE *data) {
cgdata *cg = calloc(1, sizeof(cgdata));
qnt_header *qnt = extract_header(data);
qnt_header qnt;
extract_header(data, &qnt);
cg->pic = malloc(sizeof(BYTE) * ((qnt->width+10) * (qnt->height+10) * 3));
extract_pixel(qnt, cg->pic, data + qnt->hdr_size);
cg->pic = malloc(sizeof(BYTE) * ((qnt.width+10) * (qnt.height+10) * 3));
extract_pixel(&qnt, cg->pic, data + qnt.hdr_size);
if (qnt->alpha_size != 0) {
cg->alpha = malloc(sizeof(BYTE) * ((qnt->width+10) * (qnt->height+10)));
extract_alpha(qnt, (BYTE *)cg->alpha, data + qnt->hdr_size + qnt->pixel_size);
if (qnt.alpha_size != 0) {
cg->alpha = malloc(sizeof(BYTE) * ((qnt.width+10) * (qnt.height+10)));
extract_alpha(&qnt, (BYTE *)cg->alpha, data + qnt.hdr_size + qnt.pixel_size);
}
cg->type = ALCG_QNT;
cg->x = qnt->x0;
cg->y = qnt->y0;
cg->width = qnt->width;
cg->height = qnt->height;
cg->x = qnt.x0;
cg->y = qnt.y0;
cg->width = qnt.width;
cg->height = qnt.height;
cg->pal = NULL;
return cg;
+11 -11
View File
@@ -171,7 +171,7 @@ int save_save_str_with_file(char *fname_utf8, int start, int cnt) {
*tmp = 0;
for (i = 0; i < cnt; i++) {
strncpy(tmp, v_str(start + i - 1), strvar_len - 1);
strncpy(tmp, svar_get(start + i), strvar_len - 1);
tmp[strvar_len - 1] = '\0';
tmp += strlen(tmp) + 1;
}
@@ -228,7 +228,7 @@ int save_load_str_with_file(char *fname_utf8, int start, int cnt) {
status = SAVE_LOADOK;
}
for (i = 0; i < cnt; i++) {
v_strcpy(start + i - 1, tmp);
svar_set(start + i, tmp);
tmp += strlen(tmp) + 1;
}
fclose(fp);
@@ -443,19 +443,19 @@ int save_saveAll(int no) {
char *sd_stack = NULL;
char *sd_varSys = NULL;
int i, totalsize = sizeof(Ald_baseHdr);
FILE *fp;
FILE *fp = NULL;
if (no >= SAVE_MAXNUMBER)
return SAVE_SAVEERR;
goto errexit;
if (save_base == NULL)
return SAVE_SAVEERR;
goto errexit;
fc_backup_oldfile(nact->files.save_fname[no]);
fp = fopen(nact->files.save_fname[no], "wb");
if (fp == NULL)
return SAVE_SAVEERR;
goto errexit;
memset(&save_stackHdr, 0, sizeof(Ald_stackHdr));
memset(&save_strHdr, 0, sizeof(Ald_strVarHdr));
@@ -584,8 +584,8 @@ static void *saveStrVar(Ald_strVarHdr *head) {
return NULL;
}
*tmp = 0;
for (i = 0; i < strvar_cnt; i++) {
strncpy(tmp, v_str(i), strvar_len - 1);
for (i = 1; i <= strvar_cnt; i++) {
strncpy(tmp, svar_get(i), strvar_len - 1);
tmp[strvar_len - 1] = '\0';
tmp += strlen(tmp) + 1;
}
@@ -603,10 +603,10 @@ static void loadStrVar(char *buf) {
cnt = head->count;
max = head->maxlen;
if (strvar_cnt != cnt || strvar_len != max)
v_initStringVars(cnt, max);
svar_init(cnt, max);
buf += sizeof(Ald_strVarHdr);
for (i = 0; i < cnt; i++) {
v_strcpy(i, buf);
for (i = 1; i <= cnt; i++) {
svar_set(i, buf);
buf += strlen(buf) + 1;
}
}
+9 -6
View File
@@ -29,6 +29,8 @@
#include "ags.h"
#include "cursor.h"
struct inputstring_param;
/* 初期化関係 */
extern int sdl_Initilize(void);
extern void sdl_Remove(void);
@@ -47,13 +49,13 @@ extern void sdl_fullScreen(boolean on);
extern void sdl_updateScreen(void);
/* パレット関係 */
extern void sdl_setPallet(Pallet256 *pal, int src, int cnt);
extern void sdl_setPalette(Palette256 *pal, int src, int cnt);
/* 描画関係 */
extern void sdl_drawRectangle(int x, int y, int w, int h, int cl);
extern void sdl_fillRectangle(int x, int y, int w, int h, unsigned long c);
extern void sdl_drawLine(int x1, int y1, int x2, int y2, unsigned long col);
extern int sdl_drawString(int x, int y, const char *msg, unsigned long col);
extern int sdl_drawString(int x, int y, const char *str_utf8, unsigned long col);
extern void sdl_copyArea(int sx,int sy, int w, int h, int dx, int dy);
extern void sdl_drawTT(int x,int y,int w,int h,const char *bitmap,int ww, boolean antialiased);
extern void sdl_copyAreaSP(int sx, int sy, int w, int h, int dx, int dy, int sp);
@@ -69,7 +71,7 @@ extern void sdl_copyAreaSP16_alphaLevel(int sx, int sy, int w, int h, int dx, in
extern void sdl_copyAreaSP16_whiteLevel(int sx, int sy, int w, int h, int dx, int dy, int lv);
extern void sdl_copy_from_alpha(int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_COPY_TYPE flag);
extern void sdl_copy_to_alpha(int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_COPY_TYPE flag);
extern void sdl_getPixel(int x, int y, Pallet *cell);
extern void sdl_getPixel(int x, int y, Palette *cell);
extern void sdl_putRegion(void *src, int x, int y);
extern void sdl_CopyRegion(void *src, int sx, int sy, int w, int h, int dx, int dy);
extern void sdl_restoreRegion(void *src, int x, int y);
@@ -78,7 +80,7 @@ extern void sdl_delRegion(void *src);
extern void sdl_maskupdate(int sx, int sy, int w, int h, int dx, int dy, int func, int step);
/* フォント関連 */
extern void sdl_setFontDevice(FONT *f);
extern void sdl_setFontDevice(struct _FONT *f);
/* fader */
extern void sdl_fadeIn(int step);
@@ -102,6 +104,7 @@ extern void sdl_mainIteration();
extern boolean RawKeyInfo[];
extern void sdl_sleep(int msec);
extern void sdl_wait_vsync();
extern boolean sdl_inputString(struct inputstring_param *);
/* 初期化関係 */
#define GraphicsInitilize() sdl_Initilize()
@@ -120,10 +123,10 @@ extern void sdl_wait_vsync();
#define FullScreen(on) sdl_FullScreen(on)
/* パレット関係 */
#define SetPallet(pal,src,cnt) sdl_setPallet((pal),(src),(cnt))
#define SetPalette(pal,src,cnt) sdl_setPalette((pal),(src),(cnt))
/* 描画関係 */
#define DrawString(x,y,str,col) sdl_drawString((x),(y),(str),(col))
#define DrawString(x,y,str_utf8,col) sdl_drawString((x),(y),(str_utf8),(col))
#define FillRectangle(x,y,w,h,col) sdl_fillRectangle((x),(y),(w),(h),(col))
#define CopyArea(sx,sy,w,h,dx,dy) sdl_copyArea((sx),(sy),(w),(h),(dx),(dy))
#define CopyAreaSP(sx,sy,w,h,dx,dy,col) sdl_copyAreaSP((sx),(sy),(w),(h),(dx),(dy),(col))
+7 -7
View File
@@ -60,7 +60,7 @@ static SDL_Surface *s_fader; /* fade in /out 用 work surface */
static void sdl_pal_check(void) {
if (nact->sys_pal_changed) {
nact->sys_pal_changed = FALSE;
sdl_setPallet(nact->sys_pal, 0, 256);
sdl_setPalette(nact->sys_pal, 0, 256);
}
}
@@ -127,7 +127,7 @@ static void sdl_updateAll() {
}
/* Color の複数個指定 */
void sdl_setPallet(Pallet256 *pal, int src, int cnt) {
void sdl_setPalette(Palette256 *pal, int src, int cnt) {
int i;
for (i = 0; i < cnt; i++) {
@@ -412,15 +412,15 @@ static void sdl_drawAntiAlias_8bpp(int dstx, int dsty, agsurface_t *src, unsigne
SDL_UnlockSurface(sdl_dib);
}
int sdl_drawString(int x, int y, const char *msg, unsigned long col) {
int sdl_drawString(int x, int y, const char *str_utf8, unsigned long col) {
int w;
sdl_pal_check();
if (sdl_font->self_drawable()) {
w = sdl_font->draw_glyph(x, y, msg, col);
w = sdl_font->draw_glyph(x, y, str_utf8, col);
} else {
agsurface_t *glyph = sdl_font->get_glyph(msg);
agsurface_t *glyph = sdl_font->get_glyph(str_utf8);
SDL_Rect r_src, r_dst;
if (glyph == NULL) return 0;
@@ -461,7 +461,7 @@ void sdl_Mosaic(int sx, int sy, int w, int h, int dx, int dy, int slice) {
static void setBligtness(SDL_Surface *s, int val) {
int i;
Pallet256 *pal = nact->sys_pal;
Palette256 *pal = nact->sys_pal;
Uint8 *r = pal->red, *g = pal->green, *b = pal->blue;
SDL_Color *cl = sdl_col;
@@ -476,7 +476,7 @@ static void setBligtness(SDL_Surface *s, int val) {
static void setWhiteness(SDL_Surface *s, int val) {
int i;
Pallet256 *pal = nact->sys_pal;
Palette256 *pal = nact->sys_pal;
Uint8 *r = pal->red, *g = pal->green, *b = pal->blue;
SDL_Color *cl = sdl_col;
+7 -5
View File
@@ -37,7 +37,7 @@
#include "menu.h"
#include "input.h"
#include "joystick.h"
#include "sdl_input.c"
#include "sdl_keytable.h"
#include "texthook.h"
static void sdl_getEvent(void);
@@ -96,13 +96,15 @@ static void sdl_getEvent(void) {
while (SDL_PollEvent(&e)) {
had_input = true;
if (sdl_custom_event_handler && sdl_custom_event_handler(&e))
continue;
switch (e.type) {
#ifndef __EMSCRIPTEN__
case SDL_QUIT:
nact->is_quit = TRUE;
nact->wait_vsync = TRUE;
menu_quitmenu_open();
break;
#endif
case SDL_WINDOWEVENT:
switch (e.window.event) {
case SDL_WINDOWEVENT_ENTER:
+1 -1
View File
@@ -331,7 +331,7 @@ void sdl_copy_to_alpha(int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_C
/*
* dib
*/
void sdl_getPixel(int x, int y, Pallet *cell) {
void sdl_getPixel(int x, int y, Palette *cell) {
SDL_LockSurface(sdl_dib);
if (sdl_dib->format->BitsPerPixel == 8) {
+171 -73
View File
@@ -1,73 +1,171 @@
static int sdl_keytable[SDL_NUM_SCANCODES] = {
0, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_A, KEY_B, KEY_C, KEY_D,
KEY_E, KEY_F, KEY_G, KEY_H,
KEY_I, KEY_J, KEY_K, KEY_L,
KEY_M, KEY_N, KEY_O, KEY_P,
KEY_Q, KEY_R, KEY_S, KEY_T,
KEY_U, KEY_V, KEY_W, KEY_X,
KEY_Y, KEY_Z, KEY_1, KEY_2,
KEY_3, KEY_4, KEY_5, KEY_6,
KEY_7, KEY_8, KEY_9, KEY_0,
KEY_RETURN, KEY_ESCAPE, KEY_BACKSPACE, KEY_TAB,
KEY_SPACE, 45, 46, 47,
48, 49, 50, 51,
52, 53, 54, 55,
56, KEY_CAPSLOCK, KEY_F1, KEY_F2,
KEY_F3, KEY_F4, KEY_F5, KEY_F6,
KEY_F7, KEY_F8, KEY_F9, KEY_F10,
KEY_F11, KEY_F12, KEY_PRINTSCREEN, 71,
KEY_PAUSE, KEY_INSERT, KEY_HOME, KEY_PAGEUP,
KEY_DELETE, KEY_END, KEY_PAGEDOWN, KEY_RIGHT,
KEY_LEFT, KEY_DOWN, KEY_UP, 83,
KEY_PAD_DIVIDE, KEY_PAD_MULTIPLY, KEY_PAD_MINUS, KEY_PAD_PLUS,
KEY_PAD_ENTER, KEY_PAD_1, KEY_PAD_2, KEY_PAD_3,
KEY_PAD_4, KEY_PAD_5, KEY_PAD_6, KEY_PAD_7,
KEY_PAD_8, KEY_PAD_9, KEY_PAD_0, KEY_PAD_PERIOD,
0 /* SDL_NONUSBACKSLASH */, 0 /* SDL_APPLICATION */, 0 /* SDL_POWER */, KEY_PAD_EQUALS,
KEY_F13, KEY_F14, KEY_F15, KEY_F16,
KEY_F17, KEY_F18, KEY_F19, KEY_F20,
KEY_F21, KEY_F22, KEY_F23, KEY_F24,
KEY_EXECUTE, KEY_HELP, 0 /* SDL_MENU */, KEY_SELECT,
0 /* SDL_STOP */, 0 /* SDL_AGAIN */, 0 /* SDL_UNDO */, 0 /* SDL_CUT */,
0 /* SDL_COPY */, 0 /* SDL_PASTE */, 0 /* SDL_FIND */, 0 /* SDL_MUTE */,
0 /* SDL_VOLUMEUP */, 0 /* SDL_VOLUMEDOWN */, 0 /* SDL_LOCKINGCAPSLOCK */, 0 /* SDL_LOCKINGNUMLOCK */,
0 /* SDL_LOCKINGSCROLLLOCK */, 0 /* SDL_PAD_COMMA */, 0 /* SDL_PAD_EQUALSAS400 */, 0 /* SDL_INTERNATIONAL1 */,
0 /* SDL_INTERNATIONAL2 */, 0 /* SDL_INTERNATIONAL3 */, 0 /* SDL_INTERNATIONAL4 */, 0 /* SDL_INTERNATIONAL5 */,
0 /* SDL_INTERNATIONAL6 */, 0 /* SDL_INTERNATIONAL7 */, 0 /* SDL_INTERNATIONAL8 */, 0 /* SDL_INTERNATIONAL9 */,
0 /* SDL_LANG1 */, 0 /* SDL_LANG2 */, 0 /* SDL_LANG3 */, 0 /* SDL_LANG4 */,
0 /* SDL_LANG5 */, 0 /* SDL_LANG6 */, 0 /* SDL_LANG7 */, 0 /* SDL_LANG8 */,
0 /* SDL_LANG9 */, 0 /* SDL_ALTERASE */, 0 /* SDL_SYSREQ */, 0 /* SDL_CANCEL */,
KEY_CLEAR, 0 /* SDL_PRIOR */, 0 /* SDL_RETURN2 */, 0 /* SDL_SEPARATOR */,
0 /* SDL_OUT */, 0 /* SDL_OPER */, 0 /* SDL_CLEARAGAIN */, 0 /* SDL_CRSEL */,
0 /* SDL_EXSEL */, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
0 /* SDL_PAD_00 */, 0 /* SDL_PAD_000 */, 0 /* SDL_THOUSANDSSEPARATOR */, 0 /* SDL_DECIMALSEPARATOR */,
0 /* SDL_CURRENCYUNIT */, 0 /* SDL_CURRENCYSUBUNIT */, 0 /* SDL_PAD_LEFTPAREN */, 0 /* SDL_PAD_RIGHTPAREN */,
0 /* SDL_PAD_LEFTBRACE */, 0 /* SDL_PAD_RIGHTBRACE */, 0 /* SDL_PAD_TAB */, 0 /* SDL_PAD_BACKSPACE */,
0 /* SDL_PAD_A */, 0 /* SDL_PAD_B */, 0 /* SDL_PAD_C */, 0 /* SDL_PAD_D */,
0 /* SDL_PAD_E */, 0 /* SDL_PAD_F */, 0 /* SDL_PAD_XOR */, 0 /* SDL_PAD_POWER */,
0 /* SDL_PAD_PERCENT */, 0 /* SDL_PAD_LESS */, 0 /* SDL_PAD_GREATER */, 0 /* SDL_PAD_AMPERSAND */,
0 /* SDL_PAD_DBLAMPERSAND */, 0 /* SDL_PAD_VERTICALBAR */, 0 /* SDL_PAD_DBLVERTICALBAR */, 0 /* SDL_PAD_COLON */,
0 /* SDL_PAD_HASH */, 0 /* SDL_PAD_SPACE */, 0 /* SDL_PAD_AT */, 0 /* SDL_PAD_EXCLAM */,
0 /* SDL_PAD_MEMSTORE */, 0 /* SDL_PAD_MEMRECALL */, 0 /* SDL_PAD_MEMCLEAR */, 0 /* SDL_PAD_MEMADD */,
0 /* SDL_PAD_MEMSUBTRACT */, 0 /* SDL_PAD_MEMMULTIPLY */, 0 /* SDL_PAD_MEMDIVIDE */, 0 /* SDL_PAD_PLUSMINUS */,
0 /* SDL_PAD_CLEAR */, 0 /* SDL_PAD_CLEARENTRY */, 0 /* SDL_PAD_BINARY */, 0 /* SDL_PAD_OCTAL */,
0 /* SDL_PAD_DECIMAL */, 0 /* SDL_PAD_HEXADECIMAL */, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_RCTRL, KEY_RSHIFT, KEY_RALT, 0 /* SDL_LGUI */,
KEY_RCTRL, KEY_RSHIFT, KEY_RALT, 0 /* SDL_RGUI */,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, 0 /* SDL_MODE */, 0 /* SDL_AUDIONEXT */, 0 /* SDL_AUDIOPREV */,
0 /* SDL_AUDIOSTOP */, 0 /* SDL_AUDIOPLAY */, 0 /* SDL_AUDIOMUTE */, 0 /* SDL_MEDIASELECT */,
0 /* SDL_WWW */, 0 /* SDL_MAIL */, 0 /* SDL_CALCULATOR */, 0 /* SDL_COMPUTER */,
0 /* SDL_AC_SEARCH */, 0 /* SDL_AC_HOME */, 0 /* SDL_AC_BACK */, 0 /* SDL_AC_FORWARD */,
0 /* SDL_AC_STOP */, 0 /* SDL_AC_REFRESH */, 0 /* SDL_AC_BOOKMARKS */, 0 /* SDL_BRIGHTNESSDOWN */,
0 /* SDL_BRIGHTNESSUP */, 0 /* SDL_DISPLAYSWITCH */, 0 /* SDL_KBDILLUMTOGGLE */, 0 /* SDL_KBDILLUMDOWN */,
0 /* SDL_KBDILLUMUP */, 0 /* SDL_EJECT */, 0 /* SDL_SLEEP */, 0 /* SDL_APP1 */,
0 /* SDL_APP2 */, };
/*
* Copyright (C) 2020 <KichikuouChrome@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "config.h"
#include <string.h>
#include <SDL.h>
#include "sdl_core.h"
#include "sdl_private.h"
#include "menu.h"
#include "nact.h"
#define XMARGIN 3
#define YMARGIN 2
struct EditorState {
INPUTSTRING_PARAM *params;
SDL_Rect rect;
char *text;
char composingText[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
int cursor;
boolean done;
};
static struct EditorState *input;
static void redraw() {
const int bgcolor = nact->msg.WinBackgroundColor;
const int fgcolor = nact->msg.MsgFontColor;
ags_fillRectangle(input->rect.x, input->rect.y, input->rect.w, input->rect.h, bgcolor);
SDL_Rect r = {
.x = input->rect.x + XMARGIN,
.y = input->rect.y + YMARGIN,
.w = input->rect.w - XMARGIN * 2,
.h = input->rect.h - YMARGIN * 2,
};
if (*input->text) {
int w = sdl_drawString(r.x, r.y, input->text, fgcolor);
r.x += w;
r.w -= w;
}
if (*input->composingText) {
int w = sdl_drawString(r.x, r.y, input->composingText, fgcolor);
ags_fillRectangle(r.x, r.y + r.h, w, 2, fgcolor); // underline
}
// FIXME: This doesn't work with propotional fonts!
int cursor_x = r.x + r.h * input->cursor;
ags_fillRectangle(cursor_x, r.y, 2, r.h, fgcolor); // cursor
// Dib geometry -> window geometry
r.x -= nact->sys_view_area.x;
r.y -= nact->sys_view_area.y;
SDL_SetTextInputRect(&r);
ags_updateArea(input->rect.x, input->rect.y, input->rect.w, input->rect.h);
}
static boolean handle_event(const SDL_Event *e) {
switch (e->type) {
case SDL_KEYDOWN:
if (*input->composingText)
break; // Let the IME handle this event.
switch (e->key.keysym.sym) {
case SDLK_RETURN:
input->params->newstring = input->text;
input->done = TRUE;
return TRUE;
case SDLK_ESCAPE:
input->params->newstring = NULL;
input->done = TRUE;
return TRUE;
case SDLK_BACKSPACE:
{
char *p = input->text + strlen(input->text) - 1;
while (p >= input->text && UTF8_TRAIL_BYTE(*p))
p--;
if (p >= input->text)
*p = '\0';
redraw();
}
return TRUE;
}
break;
case SDL_TEXTINPUT:
{
int chars = input->params->max;
for (const char *p = input->text; *p; p = advance_char(p, UTF8))
chars--;
const char *end = e->text.text;
while (chars > 0 && *end) {
end = advance_char(end, UTF8);
chars--;
}
strncat(input->text, e->text.text, end - e->text.text);
input->composingText[0] = '\0';
input->cursor = 0;
redraw();
}
return TRUE;
case SDL_TEXTEDITING:
strncpy(input->composingText, e->edit.text, SDL_TEXTEDITINGEVENT_TEXT_SIZE);
input->cursor = e->edit.start;
redraw();
return TRUE;
}
return FALSE;
}
boolean sdl_inputString(INPUTSTRING_PARAM *p) {
static char *buf;
free(buf);
buf = malloc(p->max * MAX_UTF8_BYTES_PAR_CHAR + 1);
struct EditorState s = {
.params = p,
.rect = {
.x = p->x + nact->sys_view_area.x, // window geometry -> dib geometry
.y = p->y + nact->sys_view_area.y,
.w = p->h * p->max + XMARGIN * 2,
.h = p->h + YMARGIN * 2
},
.text = buf,
};
strcpy(s.text, p->oldstring);
input = &s;
SDL_StartTextInput();
void *saved_region = ags_saveRegion(s.rect.x, s.rect.y, s.rect.w, s.rect.h);
ags_setFont(FONT_GOTHIC, p->h);
redraw();
sdl_custom_event_handler = handle_event;
while (!input->done) {
sdl_getKeyInfo(); // message pump
nact->callback();
sdl_wait_vsync();
}
SDL_StopTextInput();
sdl_custom_event_handler = NULL;
ags_restoreRegion(saved_region, s.rect.x, s.rect.y);
ags_updateArea(s.rect.x, s.rect.y, s.rect.w, s.rect.h);
input = NULL;
return TRUE;
}
+73
View File
@@ -0,0 +1,73 @@
static int sdl_keytable[SDL_NUM_SCANCODES] = {
0, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_A, KEY_B, KEY_C, KEY_D,
KEY_E, KEY_F, KEY_G, KEY_H,
KEY_I, KEY_J, KEY_K, KEY_L,
KEY_M, KEY_N, KEY_O, KEY_P,
KEY_Q, KEY_R, KEY_S, KEY_T,
KEY_U, KEY_V, KEY_W, KEY_X,
KEY_Y, KEY_Z, KEY_1, KEY_2,
KEY_3, KEY_4, KEY_5, KEY_6,
KEY_7, KEY_8, KEY_9, KEY_0,
KEY_RETURN, KEY_ESCAPE, KEY_BACKSPACE, KEY_TAB,
KEY_SPACE, 45, 46, 47,
48, 49, 50, 51,
52, 53, 54, 55,
56, KEY_CAPSLOCK, KEY_F1, KEY_F2,
KEY_F3, KEY_F4, KEY_F5, KEY_F6,
KEY_F7, KEY_F8, KEY_F9, KEY_F10,
KEY_F11, KEY_F12, KEY_PRINTSCREEN, 71,
KEY_PAUSE, KEY_INSERT, KEY_HOME, KEY_PAGEUP,
KEY_DELETE, KEY_END, KEY_PAGEDOWN, KEY_RIGHT,
KEY_LEFT, KEY_DOWN, KEY_UP, 83,
KEY_PAD_DIVIDE, KEY_PAD_MULTIPLY, KEY_PAD_MINUS, KEY_PAD_PLUS,
KEY_PAD_ENTER, KEY_PAD_1, KEY_PAD_2, KEY_PAD_3,
KEY_PAD_4, KEY_PAD_5, KEY_PAD_6, KEY_PAD_7,
KEY_PAD_8, KEY_PAD_9, KEY_PAD_0, KEY_PAD_PERIOD,
0 /* SDL_NONUSBACKSLASH */, 0 /* SDL_APPLICATION */, 0 /* SDL_POWER */, KEY_PAD_EQUALS,
KEY_F13, KEY_F14, KEY_F15, KEY_F16,
KEY_F17, KEY_F18, KEY_F19, KEY_F20,
KEY_F21, KEY_F22, KEY_F23, KEY_F24,
KEY_EXECUTE, KEY_HELP, 0 /* SDL_MENU */, KEY_SELECT,
0 /* SDL_STOP */, 0 /* SDL_AGAIN */, 0 /* SDL_UNDO */, 0 /* SDL_CUT */,
0 /* SDL_COPY */, 0 /* SDL_PASTE */, 0 /* SDL_FIND */, 0 /* SDL_MUTE */,
0 /* SDL_VOLUMEUP */, 0 /* SDL_VOLUMEDOWN */, 0 /* SDL_LOCKINGCAPSLOCK */, 0 /* SDL_LOCKINGNUMLOCK */,
0 /* SDL_LOCKINGSCROLLLOCK */, 0 /* SDL_PAD_COMMA */, 0 /* SDL_PAD_EQUALSAS400 */, 0 /* SDL_INTERNATIONAL1 */,
0 /* SDL_INTERNATIONAL2 */, 0 /* SDL_INTERNATIONAL3 */, 0 /* SDL_INTERNATIONAL4 */, 0 /* SDL_INTERNATIONAL5 */,
0 /* SDL_INTERNATIONAL6 */, 0 /* SDL_INTERNATIONAL7 */, 0 /* SDL_INTERNATIONAL8 */, 0 /* SDL_INTERNATIONAL9 */,
0 /* SDL_LANG1 */, 0 /* SDL_LANG2 */, 0 /* SDL_LANG3 */, 0 /* SDL_LANG4 */,
0 /* SDL_LANG5 */, 0 /* SDL_LANG6 */, 0 /* SDL_LANG7 */, 0 /* SDL_LANG8 */,
0 /* SDL_LANG9 */, 0 /* SDL_ALTERASE */, 0 /* SDL_SYSREQ */, 0 /* SDL_CANCEL */,
KEY_CLEAR, 0 /* SDL_PRIOR */, 0 /* SDL_RETURN2 */, 0 /* SDL_SEPARATOR */,
0 /* SDL_OUT */, 0 /* SDL_OPER */, 0 /* SDL_CLEARAGAIN */, 0 /* SDL_CRSEL */,
0 /* SDL_EXSEL */, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
0 /* SDL_PAD_00 */, 0 /* SDL_PAD_000 */, 0 /* SDL_THOUSANDSSEPARATOR */, 0 /* SDL_DECIMALSEPARATOR */,
0 /* SDL_CURRENCYUNIT */, 0 /* SDL_CURRENCYSUBUNIT */, 0 /* SDL_PAD_LEFTPAREN */, 0 /* SDL_PAD_RIGHTPAREN */,
0 /* SDL_PAD_LEFTBRACE */, 0 /* SDL_PAD_RIGHTBRACE */, 0 /* SDL_PAD_TAB */, 0 /* SDL_PAD_BACKSPACE */,
0 /* SDL_PAD_A */, 0 /* SDL_PAD_B */, 0 /* SDL_PAD_C */, 0 /* SDL_PAD_D */,
0 /* SDL_PAD_E */, 0 /* SDL_PAD_F */, 0 /* SDL_PAD_XOR */, 0 /* SDL_PAD_POWER */,
0 /* SDL_PAD_PERCENT */, 0 /* SDL_PAD_LESS */, 0 /* SDL_PAD_GREATER */, 0 /* SDL_PAD_AMPERSAND */,
0 /* SDL_PAD_DBLAMPERSAND */, 0 /* SDL_PAD_VERTICALBAR */, 0 /* SDL_PAD_DBLVERTICALBAR */, 0 /* SDL_PAD_COLON */,
0 /* SDL_PAD_HASH */, 0 /* SDL_PAD_SPACE */, 0 /* SDL_PAD_AT */, 0 /* SDL_PAD_EXCLAM */,
0 /* SDL_PAD_MEMSTORE */, 0 /* SDL_PAD_MEMRECALL */, 0 /* SDL_PAD_MEMCLEAR */, 0 /* SDL_PAD_MEMADD */,
0 /* SDL_PAD_MEMSUBTRACT */, 0 /* SDL_PAD_MEMMULTIPLY */, 0 /* SDL_PAD_MEMDIVIDE */, 0 /* SDL_PAD_PLUSMINUS */,
0 /* SDL_PAD_CLEAR */, 0 /* SDL_PAD_CLEARENTRY */, 0 /* SDL_PAD_BINARY */, 0 /* SDL_PAD_OCTAL */,
0 /* SDL_PAD_DECIMAL */, 0 /* SDL_PAD_HEXADECIMAL */, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_RCTRL, KEY_RSHIFT, KEY_RALT, 0 /* SDL_LGUI */,
KEY_RCTRL, KEY_RSHIFT, KEY_RALT, 0 /* SDL_RGUI */,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED, KEY_UNDEFINED,
KEY_UNDEFINED, 0 /* SDL_MODE */, 0 /* SDL_AUDIONEXT */, 0 /* SDL_AUDIOPREV */,
0 /* SDL_AUDIOSTOP */, 0 /* SDL_AUDIOPLAY */, 0 /* SDL_AUDIOMUTE */, 0 /* SDL_MEDIASELECT */,
0 /* SDL_WWW */, 0 /* SDL_MAIL */, 0 /* SDL_CALCULATOR */, 0 /* SDL_COMPUTER */,
0 /* SDL_AC_SEARCH */, 0 /* SDL_AC_HOME */, 0 /* SDL_AC_BACK */, 0 /* SDL_AC_FORWARD */,
0 /* SDL_AC_STOP */, 0 /* SDL_AC_REFRESH */, 0 /* SDL_AC_BOOKMARKS */, 0 /* SDL_BRIGHTNESSDOWN */,
0 /* SDL_BRIGHTNESSUP */, 0 /* SDL_DISPLAYSWITCH */, 0 /* SDL_KBDILLUMTOGGLE */, 0 /* SDL_KBDILLUMDOWN */,
0 /* SDL_KBDILLUMUP */, 0 /* SDL_EJECT */, 0 /* SDL_SLEEP */, 0 /* SDL_APP1 */,
0 /* SDL_APP2 */, };

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