mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-24 23:48:04 +03:00
Compare commits
78
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cfa9dc3502 | ||
|
|
f978c43ee1 | ||
|
|
7871bb9328 | ||
|
|
ab32b1792f | ||
|
|
98d0a13a20 | ||
|
|
5456ac4219 | ||
|
|
f258ae42b1 | ||
|
|
6a459260e4 | ||
|
|
6580b864c0 | ||
|
|
bfd8e3e55a | ||
|
|
05cacb170f | ||
|
|
d2c861ad53 | ||
|
|
8a395a57e4 | ||
|
|
6706348c11 | ||
|
|
c66714bab6 | ||
|
|
730b15dfca | ||
|
|
ad6c84db4d | ||
|
|
9053583517 | ||
|
|
07f8f8a5f8 | ||
|
|
9f244c3dee | ||
|
|
2e895ed3ae | ||
|
|
b5010df10d | ||
|
|
fc5f89912e | ||
|
|
70ea305ca9 | ||
|
|
b4eb18c938 | ||
|
|
b9e0d97156 | ||
|
|
350d8bb367 | ||
|
|
fb10cbc52d | ||
|
|
55976a5816 | ||
|
|
827f98d24a | ||
|
|
ce67aa7028 | ||
|
|
50b3812364 | ||
|
|
616534621e | ||
|
|
1f5ec7a9a9 | ||
|
|
06223ea727 | ||
|
|
d15c770b4b | ||
|
|
60bb70c456 | ||
|
|
52322345b5 | ||
|
|
66693ad39a | ||
|
|
73fab9b628 | ||
|
|
bdfe0e8077 | ||
|
|
03f8af2241 | ||
|
|
c03b6cf6b5 | ||
|
|
1a3b779ace | ||
|
|
4c58510a37 | ||
|
|
b4c729a1f6 | ||
|
|
daf5098530 | ||
|
|
4223284781 | ||
|
|
3d70d00bce | ||
|
|
f2fbf54c32 | ||
|
|
b4d2c0832e | ||
|
|
d777b18b55 | ||
|
|
7b3efd9aaa | ||
|
|
90eb139994 | ||
|
|
aa87e3e8c0 | ||
|
|
1cd949f597 | ||
|
|
426cdaa836 | ||
|
|
8db5a9cd65 | ||
|
|
47f82e87c5 | ||
|
|
86470e543a | ||
|
|
a23ce19433 | ||
|
|
1cf197513c | ||
|
|
64c3c28336 | ||
|
|
7309ed012f | ||
|
|
515a92544b | ||
|
|
725b0ee6ab | ||
|
|
e17b447e73 | ||
|
|
6dbd31cdbc | ||
|
|
a217df39b1 | ||
|
|
80266d6454 | ||
|
|
2e17188f2b | ||
|
|
37f4d847e5 | ||
|
|
43c6688ce7 | ||
|
|
09e89e794d | ||
|
|
3fd7a58544 | ||
|
|
f0ccdcf40a | ||
|
|
1a6b7b33b9 | ||
|
|
7240971beb |
@@ -1,5 +1,5 @@
|
||||
name: Android Build
|
||||
on: [push]
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: Emscripten Build
|
||||
on: [push]
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
emscripten-version: 1.39.16
|
||||
@@ -11,25 +11,17 @@ jobs:
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Cache emsdk
|
||||
uses: actions/cache@v1
|
||||
id: cache
|
||||
with:
|
||||
path: emsdk-cache
|
||||
key: ${{ runner.os }}-emsdk-${{ env.emscripten-version }}
|
||||
|
||||
- name: Cache .emscripten_cache
|
||||
uses: actions/cache@v1
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: emscripten-cache
|
||||
key: emscripten-cache-${{ env.emscripten-version }}
|
||||
|
||||
- name: Setup Emscripten toolchain
|
||||
uses: mymindstorm/setup-emsdk@v3
|
||||
uses: mymindstorm/setup-emsdk@v6
|
||||
with:
|
||||
version: ${{ env.emscripten-version }}
|
||||
actions-cache-folder: emsdk-cache
|
||||
no-cache: true
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
@@ -45,7 +37,7 @@ jobs:
|
||||
mv src/xsystem35.* xsystem35/
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v1
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: xsystem35-wasm
|
||||
path: out/wasm/xsystem35
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
name: Linux Build
|
||||
on: [push]
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
build-type: ["Debug", "Release"]
|
||||
|
||||
name: Linux ${{ matrix.build-type }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -15,11 +19,29 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p out/debug
|
||||
cd out/debug
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
mkdir -p out/${{ matrix.build-type }}
|
||||
cd out/${{ matrix.build-type }}
|
||||
cmake -DENABLE_X11=NO -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} ../../
|
||||
make
|
||||
|
||||
- name: Test
|
||||
run: ctest
|
||||
working-directory: out/debug
|
||||
run: ctest --output-on-failure
|
||||
working-directory: out/${{ matrix.build-type }}
|
||||
|
||||
build-x11:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
name: Linux X11
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p out
|
||||
cd out
|
||||
cmake ../
|
||||
make
|
||||
|
||||
- name: Test
|
||||
run: ctest --output-on-failure
|
||||
working-directory: out
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
name: Windows Build
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
mingw: ["MINGW32", "MINGW64"]
|
||||
include:
|
||||
- mingw: "MINGW32"
|
||||
package: "mingw-w64-i686"
|
||||
installer: "xsystem35-32bit"
|
||||
- mingw: "MINGW64"
|
||||
package: "mingw-w64-x86_64"
|
||||
installer: "xsystem35-64bit"
|
||||
defaults:
|
||||
run:
|
||||
shell: bash.exe --login -eo pipefail "{0}"
|
||||
env:
|
||||
MSYSTEM: ${{ matrix.mingw }}
|
||||
CHERE_INVOKING: 1
|
||||
name: MSYS2 ${{ matrix.mingw }}
|
||||
steps:
|
||||
|
||||
- name: Set up shell
|
||||
run: echo ::add-path::C:\msys64\usr\bin\
|
||||
shell: pwsh
|
||||
|
||||
- name: Print system version
|
||||
run: |
|
||||
uname
|
||||
echo PATH: $PATH
|
||||
|
||||
- name: Install Deps
|
||||
run: pacman -S --noconfirm ${{ matrix.package }}-SDL2 ${{ matrix.package }}-SDL2_ttf ${{ matrix.package }}-SDL2_mixer ${{ matrix.package }}-libjpeg-turbo ${{ matrix.package }}-nsis ${{ matrix.package }}-ntldd-git
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p out/release
|
||||
cd out/release
|
||||
cmake -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release ../../
|
||||
make
|
||||
|
||||
- name: Test
|
||||
run: ctest --output-on-failure
|
||||
working-directory: out/release
|
||||
|
||||
- name: Package
|
||||
working-directory: installer
|
||||
run: ./make-installer.sh ../out/release ${{ matrix.installer }}.nsi
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ matrix.installer }}
|
||||
path: installer/${{ matrix.installer }}.exe
|
||||
+9
-7
@@ -71,13 +71,15 @@ else()
|
||||
optional_find_package(Freetype)
|
||||
|
||||
include(FindPkgConfig)
|
||||
if (NOT X11_FOUND)
|
||||
optional_pkg_check_modules(SDL2 IMPORTED_TARGET sdl2)
|
||||
endif()
|
||||
|
||||
optional_pkg_check_modules(SDL2 IMPORTED_TARGET sdl2)
|
||||
optional_pkg_check_modules(SDL2MIXER IMPORTED_TARGET SDL2_mixer)
|
||||
optional_pkg_check_modules(SDL2TTF IMPORTED_TARGET SDL2_ttf)
|
||||
|
||||
include(FindJPEG)
|
||||
if (JPEG_FOUND)
|
||||
set(HAVE_JPEG 1)
|
||||
endif()
|
||||
|
||||
set(DEFAULT_FONT_PATH ${CMAKE_INSTALL_PREFIX}/share/xsystem35/fonts/)
|
||||
endif()
|
||||
|
||||
@@ -155,7 +157,7 @@ if (SDL2MIXER_FOUND AND NOT ANDROID)
|
||||
list(APPEND SUMMARY_CDROM "SDL_mixer (wav|mp3|ogg...)")
|
||||
set(ENABLE_CDROM_MP3 1)
|
||||
endif()
|
||||
set(CDROM_DEVICE "/dev/cdrom" CACHE STRING "CDROM Device Name")
|
||||
set(CDROM_DEVICE "playlist.txt" CACHE STRING "CDROM Device Name")
|
||||
|
||||
# MIDI
|
||||
|
||||
@@ -197,7 +199,7 @@ endif()
|
||||
|
||||
if (EMSCRIPTEN OR ANDROID)
|
||||
set(SRC_JOYSTICK joystick_dmy.c)
|
||||
elseif (SDL2_FOUND)
|
||||
elseif (ENABLE_SDL)
|
||||
set(SRC_JOYSTICK joystick_sdl.c)
|
||||
set(SUMMARY_JOYSTICK "SDL")
|
||||
set(HAVE_SDLJOY 1)
|
||||
@@ -220,7 +222,7 @@ if (X11_FOUND)
|
||||
set(ENABLE_X11FONT 1)
|
||||
endif()
|
||||
if (FREETYPE_FOUND)
|
||||
list(APPEND SRC_FONT font_freetype2.c cp932tojis0213.c)
|
||||
list(APPEND SRC_FONT font_freetype2.c)
|
||||
list(APPEND SUMMARY_FONT "freetype2")
|
||||
set(ENABLE_FT2 1)
|
||||
endif()
|
||||
|
||||
@@ -20,7 +20,7 @@ cmake の実行でエラーになる場合は必要なライブラリをイン
|
||||
|
||||
[Homebrew](https://brew.sh/index_ja) が必要です。
|
||||
|
||||
$ brew install cmake pkg-config sdl2 sdl2_mixer freetype
|
||||
$ brew install cmake pkg-config sdl2 sdl2_mixer freetype libjpeg
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
@@ -30,7 +30,7 @@ cmake の実行でエラーになる場合は必要なライブラリをイン
|
||||
|
||||
[MSYS2](https://www.msys2.org) が必要です。
|
||||
|
||||
$ 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
|
||||
$ 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
|
||||
$ cd out/debug
|
||||
$ cmake -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
|
||||
@@ -16,8 +16,8 @@ android {
|
||||
}
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 26
|
||||
versionCode 3
|
||||
versionName "0.2.0"
|
||||
versionCode 4
|
||||
versionName "0.2.1"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
|
||||
|
||||
@@ -40,6 +40,7 @@ endif()
|
||||
FetchContent_GetProperties(SDL_mixer)
|
||||
if(NOT sdl_mixer_POPULATED)
|
||||
FetchContent_Populate(SDL_mixer)
|
||||
SET(SUPPORT_OGG ON CACHE BOOL "Enable OGG support in SDL_mixer" FORCE)
|
||||
add_subdirectory(${sdl_mixer_SOURCE_DIR} ${sdl_mixer_BINARY_DIR})
|
||||
# Workaround for CMakeLists.txt bugs of SDL_mixer.
|
||||
# TODO: Fix these in upstream
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.io.IOException
|
||||
class GameActivity : SDLActivity() {
|
||||
companion object {
|
||||
const val EXTRA_GAME_ROOT = "GAME_ROOT"
|
||||
const val EXTRA_ARCHIVE_NAME = "ARCHIVE_NAME"
|
||||
}
|
||||
|
||||
private lateinit var gameRoot: File
|
||||
@@ -63,9 +64,12 @@ class GameActivity : SDLActivity() {
|
||||
|
||||
override fun setTitle(title: CharSequence?) {
|
||||
super.setTitle(title)
|
||||
val str = title?.toString()?.substringAfter(':', "")
|
||||
if (str.isNullOrEmpty())
|
||||
return
|
||||
var str = title?.toString()?.substringAfter(':', "")
|
||||
if (str.isNullOrEmpty()) {
|
||||
str = intent.getStringExtra(EXTRA_ARCHIVE_NAME)
|
||||
if (str == null)
|
||||
return
|
||||
}
|
||||
File(gameRoot, Launcher.TITLE_FILE).writeText(str)
|
||||
Launcher.updateGameList()
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ private var gLauncher: Launcher? = null
|
||||
interface LauncherObserver {
|
||||
fun onGameListChange()
|
||||
fun onInstallProgress(path: String)
|
||||
fun onInstallSuccess(path: File)
|
||||
fun onInstallSuccess(path: File, archiveName: String?)
|
||||
fun onInstallFailure(msgId: Int)
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
updateGameList()
|
||||
}
|
||||
|
||||
fun install(input: InputStream) {
|
||||
fun install(input: InputStream, archiveName: String?) {
|
||||
val dir = createDirForGame()
|
||||
@SuppressLint("HandlerLeak")
|
||||
val handler = object : Handler() {
|
||||
@@ -84,7 +84,7 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
}
|
||||
SUCCESS -> {
|
||||
isInstalling = false
|
||||
observer?.onInstallSuccess(msg.obj as File)
|
||||
observer?.onInstallSuccess(msg.obj as File, archiveName)
|
||||
}
|
||||
FAILURE -> {
|
||||
isInstalling = false
|
||||
|
||||
@@ -19,7 +19,9 @@ package io.github.kichikuou.xsystem35
|
||||
|
||||
import android.app.*
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.provider.OpenableColumns
|
||||
import android.util.Log
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
@@ -60,7 +62,7 @@ class LauncherActivity : ListActivity(), AdapterView.OnItemLongClickListener, La
|
||||
override fun onListItemClick(l: ListView?, v: View?, position: Int, id: Long) {
|
||||
super.onListItemClick(l, v, position, id)
|
||||
if (position < launcher.games.size) {
|
||||
startGame(launcher.games[position].path)
|
||||
startGame(launcher.games[position].path, null)
|
||||
} else {
|
||||
val i = Intent(Intent.ACTION_GET_CONTENT)
|
||||
i.type = CONTENT_TYPE_ZIP
|
||||
@@ -112,7 +114,7 @@ class LauncherActivity : ListActivity(), AdapterView.OnItemLongClickListener, La
|
||||
INSTALL_REQUEST -> {
|
||||
val input = contentResolver.openInputStream(uri) ?: return
|
||||
showProgressDialog()
|
||||
launcher.install(input)
|
||||
launcher.install(input, getArchiveName(uri))
|
||||
}
|
||||
SAVEDATA_EXPORT_REQUEST -> try {
|
||||
launcher.exportSaveData(contentResolver.openOutputStream(uri)!!)
|
||||
@@ -144,9 +146,9 @@ class LauncherActivity : ListActivity(), AdapterView.OnItemLongClickListener, La
|
||||
progressDialog?.setProgress(getString(R.string.install_progress, path))
|
||||
}
|
||||
|
||||
override fun onInstallSuccess(path: File) {
|
||||
override fun onInstallSuccess(path: File, archiveName: String?) {
|
||||
dismissProgressDialog()
|
||||
startGame(path)
|
||||
startGame(path, archiveName)
|
||||
}
|
||||
|
||||
override fun onInstallFailure(msgId: Int) {
|
||||
@@ -154,10 +156,11 @@ class LauncherActivity : ListActivity(), AdapterView.OnItemLongClickListener, La
|
||||
errorDialog(msgId)
|
||||
}
|
||||
|
||||
private fun startGame(path: File) {
|
||||
private fun startGame(path: File, archiveName: String?) {
|
||||
val i = Intent()
|
||||
i.setClass(applicationContext, GameActivity::class.java)
|
||||
i.putExtra(GameActivity.EXTRA_GAME_ROOT, path.path)
|
||||
i.putExtra(GameActivity.EXTRA_ARCHIVE_NAME, archiveName)
|
||||
startActivity(i)
|
||||
}
|
||||
|
||||
@@ -181,6 +184,17 @@ class LauncherActivity : ListActivity(), AdapterView.OnItemLongClickListener, La
|
||||
.setPositiveButton(R.string.ok) {_, _ -> }
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun getArchiveName(uri: Uri): String? {
|
||||
val cursor = contentResolver.query(uri, null, null, null, null, null)
|
||||
cursor?.use {
|
||||
if (it.moveToFirst()) {
|
||||
val fname = it.getString(it.getColumnIndex(OpenableColumns.DISPLAY_NAME))
|
||||
return if (fname.endsWith(".zip", true)) fname.dropLast(4) else fname
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION") // for ProgressDialog
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#cmakedefine QUIET_MIDI @QUIET_MIDI@
|
||||
|
||||
#cmakedefine HAVE_GETLOGIN @HAVE_GETLOGIN@
|
||||
#cmakedefine HAVE_JPEG @HAVE_JPEG@
|
||||
#cmakedefine HAVE_MMAP @HAVE_MMAP@
|
||||
#cmakedefine HAVE_SDLJOY @HAVE_SDLJOY@
|
||||
#cmakedefine HAVE_SIGACTION @HAVE_SIGACTION@
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
Midi : MIDIデータ
|
||||
Data : その他データ
|
||||
Save : セーブデータ
|
||||
Resouce : リソースファイル(マウスカーソル形状)
|
||||
Resource : リソースファイル(マウスカーソル形状)
|
||||
Ain : DLL とその関数の情報のかかれた System39.ain
|
||||
BGM : BGMデータ(エスカレイヤー以降のBGMデータファイル)
|
||||
WAI : PCMデータの追加情報 (mixer channel 情報等)
|
||||
|
||||
@@ -225,10 +225,6 @@
|
||||
|
||||
-devjoy name : joystick のデバイス名を name にします
|
||||
|
||||
-savekanji # : ゲーム内でファイル名を指定してセーブデータを記録するとき、
|
||||
日本語のファイル名を UTF-8 と SJIS のどちらで保存するかを
|
||||
指定します。(# は 0 または 1 ... 0:utf-8, 1:sjis)
|
||||
|
||||
-version : バージョン情報を表示します。
|
||||
|
||||
-fullscreen : フルスクリーンでゲームを実行します。
|
||||
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# To use this script in MSYS2 shell, install mingw-w64-x86_64-nsis and
|
||||
# mingw-w64-x86_64-ntldd-git packages.
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo 'Usage: make-installer.sh <build-dir> <nsi>'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
builddir=$1
|
||||
nsi=$2
|
||||
|
||||
echo 'dlls.nsi:'
|
||||
ntldd -R $builddir/src/xsystem35.exe |perl -ne 'print "File \"$1\"\n" if /=> (.*) \(/' |grep mingw |tee $builddir/dlls.nsi
|
||||
echo
|
||||
|
||||
echo 'dlls-uninstall.nsi:'
|
||||
sed 's/^File ".*\\/Delete "$INSTDIR\\/' $builddir/dlls.nsi |tee $builddir/dlls-uninstall.nsi
|
||||
echo
|
||||
|
||||
makensis -INPUTCHARSET UTF8 -DBUILDDIR="$builddir" "$nsi"
|
||||
@@ -0,0 +1,5 @@
|
||||
Unicode true
|
||||
Name xsystem35
|
||||
OutFile xsystem35-32bit.exe
|
||||
InstallDir $PROGRAMFILES32\xsystem35
|
||||
!include xsystem35.nsi
|
||||
@@ -0,0 +1,5 @@
|
||||
Unicode true
|
||||
Name xsystem35
|
||||
OutFile xsystem35-64bit.exe
|
||||
InstallDir $PROGRAMFILES64\xsystem35
|
||||
!include xsystem35.nsi
|
||||
@@ -0,0 +1,77 @@
|
||||
ManifestDPIAware true
|
||||
SetCompressor /SOLID lzma
|
||||
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Japanese.nlf"
|
||||
|
||||
Page license
|
||||
Page directory
|
||||
Page components
|
||||
Page instfiles
|
||||
UninstPage uninstConfirm
|
||||
UninstPage instfiles
|
||||
|
||||
LicenseData ..\COPYING
|
||||
|
||||
!define SHCNE_ASSOCCHANGED 0x08000000
|
||||
!define SHCNF_IDLIST 0
|
||||
Function RefreshShellIcons
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v \
|
||||
(${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SetOutPath $INSTDIR
|
||||
FILE ${BUILDDIR}\src\xsystem35.exe
|
||||
!include ${BUILDDIR}\dlls.nsi
|
||||
SetOutPath $INSTDIR\fonts
|
||||
FILE /x CMakeLists.txt ..\fonts\*.*
|
||||
WriteUninstaller $INSTDIR\uninstall.exe
|
||||
|
||||
WriteRegStr HKLM "Software\Kichikuou\xsystem35\profile" "ttfont_gothic" "$INSTDIR\fonts\MTLc3m.ttf"
|
||||
WriteRegStr HKLM "Software\Kichikuou\xsystem35\profile" "ttfont_mincho" "$INSTDIR\fonts\mincho.otf"
|
||||
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xsystem35" "DisplayName" "xsystem35 (remove only)"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xsystem35" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
SectionEnd
|
||||
|
||||
LangString FileAssociation ${LANG_ENGLISH} "Associate with .ALD file type"
|
||||
LangString FileAssociation ${LANG_JAPANESE} ".ALD ファイルに関連付け"
|
||||
Section "$(FileAssociation)"
|
||||
WriteRegStr HKCR ".ald" "" "System35Archive"
|
||||
WriteRegStr HKCR "System35Archive" "" "AliceSoft System 3.x archive"
|
||||
WriteRegStr HKCR "System35Archive\DefaultIcon" "" "$INSTDIR\xsystem35.exe,0"
|
||||
WriteRegStr HKCR "System35Archive\shell\open\command" "" '"$INSTDIR\xsystem35.exe" "%1"'
|
||||
Call RefreshShellIcons
|
||||
SectionEnd
|
||||
|
||||
LangString DesktopIcon ${LANG_ENGLISH} "Create Desktop icon"
|
||||
LangString DesktopIcon ${LANG_JAPANESE} "デスクトップショートカットを作成"
|
||||
Section "$(DesktopIcon)"
|
||||
CreateShortcut $DESKTOP\xsystem35.lnk $INSTDIR\xsystem35.exe
|
||||
SectionEnd
|
||||
|
||||
LangString StartMenu ${LANG_ENGLISH} "Create Start menu entry"
|
||||
LangString StartMenu ${LANG_JAPANESE} "スタートメニューに登録"
|
||||
Section "$(StartMenu)"
|
||||
CreateDirectory $SMPROGRAMS\xsystem35
|
||||
CreateShortcut $SMPROGRAMS\xsystem35\xsystem35.lnk $INSTDIR\xsystem35.exe
|
||||
CreateShortcut $SMPROGRAMS\xsystem35\uninstall.lnk $INSTDIR\uninstall.exe
|
||||
SectionEnd
|
||||
|
||||
Section "Uninstall"
|
||||
Delete $DESKTOP\xsystem35.lnk
|
||||
RMDir /r $SMPROGRAMS\xsystem35
|
||||
|
||||
DeleteRegKey HKCR ".ald"
|
||||
DeleteRegKey HKCR "System35Archive"
|
||||
|
||||
DeleteRegKey HKLM "Software\Kichikuou\xsystem35"
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xsystem35"
|
||||
|
||||
RMDir /r $INSTDIR\fonts
|
||||
Delete $INSTDIR\uninstall.exe
|
||||
Delete $INSTDIR\xsystem35.exe
|
||||
!include ${BUILDDIR}\dlls-uninstall.nsi
|
||||
RMDir $INSTDIR
|
||||
SectionEnd
|
||||
@@ -70,7 +70,7 @@ add_library(modules STATIC
|
||||
|
||||
target_include_directories(modules PUBLIC .)
|
||||
|
||||
target_compile_options(modules PRIVATE -Wno-pointer-sign -Wno-invalid-source-encoding)
|
||||
target_compile_options(modules PRIVATE -Wno-pointer-sign)
|
||||
target_link_libraries(modules PRIVATE graph alk drawtext list)
|
||||
|
||||
if (SDL2MIXER_FOUND)
|
||||
@@ -81,9 +81,7 @@ if (SDL2MIXER_FOUND)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindJPEG)
|
||||
if (JPEG_FOUND)
|
||||
target_compile_definitions(modules PRIVATE HAVE_JPEG)
|
||||
if (HAVE_JPEG)
|
||||
target_sources(modules PRIVATE
|
||||
NightDemonDemo/ndd.c
|
||||
NightDemonDemo/jpeg2surface.c
|
||||
|
||||
@@ -17,12 +17,14 @@
|
||||
#include "nt_msg.h"
|
||||
#include "sprite.h"
|
||||
#include "sactcg.h"
|
||||
#include "sjisname.h"
|
||||
#include "sactstring.h"
|
||||
|
||||
|
||||
extern int ntsel_dosel(void);
|
||||
|
||||
#define SNAME_RYO "亮 "
|
||||
#define SNAME_RYO_DEF "亮"
|
||||
|
||||
// 通常メッセージ表示位置と大きさ
|
||||
#define MSGFRAME_0_X 6
|
||||
#define MSGFRAME_0_Y 347
|
||||
@@ -102,7 +104,7 @@ void ntmsg_init() {
|
||||
|
||||
|
||||
// 主人公名前
|
||||
nt_sstr_regist_replace(SNAME_RYO, SNAME_RYO_DEF);
|
||||
nt_sstr_regist_replace(utf2sjis(SNAME_RYO), utf2sjis(SNAME_RYO_DEF));
|
||||
|
||||
night.msg.cbmove = cb_mousemove;
|
||||
night.msg.cbrelease = cb_keyrelease;
|
||||
@@ -179,7 +181,7 @@ void ntmsg_newline() {
|
||||
ntmsg_add(buf);
|
||||
}
|
||||
|
||||
void ntmsg_add(char *msg) {
|
||||
void ntmsg_add(const char *msg) {
|
||||
int len;
|
||||
|
||||
SACT_DEBUG("len = %d\n", strlen(msg));
|
||||
@@ -187,7 +189,7 @@ void ntmsg_add(char *msg) {
|
||||
if (msg[0] == '\0') return;
|
||||
|
||||
if (0) {
|
||||
char *b = sjis2lang(msg);
|
||||
char *b = sjis2utf(msg);
|
||||
fprintf(stderr, "add msg '%s'\n", b);
|
||||
free(b);
|
||||
}
|
||||
@@ -259,7 +261,7 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
|
||||
dt_setfont(wFont, wSize);
|
||||
|
||||
if (1) {
|
||||
char *b = sjis2lang(mbuf);
|
||||
char *b = sjis2utf(mbuf);
|
||||
fprintf(stderr, "msg '%s'\n", b);
|
||||
free(b);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ extern void ntmsg_init();
|
||||
extern void ntmsg_set_frame(int type);
|
||||
extern void ntmsg_set_place(int type);
|
||||
extern void ntmsg_newline();
|
||||
extern void ntmsg_add(char *msg);
|
||||
extern void ntmsg_add(const char *msg);
|
||||
extern int ntmsg_ana(void);
|
||||
extern int ntmsg_update(sprite_t *sp, MyRectangle *r);
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ int nt_scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cTex
|
||||
FONT *font;
|
||||
|
||||
if (0) {
|
||||
char *b = sjis2lang(cText);
|
||||
char *b = sjis2utf(cText);
|
||||
WARNING("str = '%s'\n", b);
|
||||
free(b);
|
||||
}
|
||||
|
||||
@@ -97,8 +97,8 @@ int nt_sstr_regist_replace(char *sstr, char *dstr) {
|
||||
if (sstr == dstr) return NG;
|
||||
|
||||
ex = malloc(sizeof(strexchange_t));
|
||||
ex->src = strdup(sstr);
|
||||
ex->dst = strdup(dstr);
|
||||
ex->src = sstr;
|
||||
ex->dst = dstr;
|
||||
strreplace = slist_append(strreplace, ex);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#define SNAME_RYO "亮 "
|
||||
#define SNAME_RYO_DEF "亮"
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "modules.h"
|
||||
#include "nact.h"
|
||||
|
||||
extern void ndd_init(char *files[], int n);
|
||||
extern void ndd_init(const char *files[], int n);
|
||||
extern void ndd_run(int demonum);
|
||||
|
||||
static void Init() {
|
||||
|
||||
@@ -21,10 +21,12 @@
|
||||
*/
|
||||
/* $Id: jpeg2surface.c,v 1.2 2003/11/09 15:06:12 chikama Exp $ */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <jpeglib.h>
|
||||
#undef max
|
||||
#undef min
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "portab.h"
|
||||
#include "ags.h"
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
// 2: Meteo
|
||||
|
||||
struct nddemo {
|
||||
char **fn;
|
||||
const char **fn;
|
||||
alk_t *alk;
|
||||
surface_t *sf[10];
|
||||
};
|
||||
@@ -52,7 +52,7 @@ static int ndemo_nums[3] = {150, 603, 467};
|
||||
extern surface_t *jpeg2surface(FILE *fp, int offset);
|
||||
|
||||
// ALKファイルの登録
|
||||
void ndd_init(char *files[], int n) {
|
||||
void ndd_init(const char *files[], int n) {
|
||||
int i;
|
||||
ndd.fn = malloc(sizeof(char *) * n);
|
||||
|
||||
|
||||
+2
-2
@@ -103,9 +103,9 @@ static void Init() {
|
||||
int p1 = getCaliValue(); /* ISys3x */
|
||||
|
||||
// ゲームタイトルによるバージョン設定
|
||||
if (0 == strcmp(nact->game_title_name, GT_ESUKA)) {
|
||||
if (0 == strcmp(nact->game_title_utf8, GT_ESUKA)) {
|
||||
sact.version = 100;
|
||||
} else if (0 == strcmp(nact->game_title_name, GT_RANCE5D)){
|
||||
} else if (0 == strcmp(nact->game_title_utf8, GT_RANCE5D)){
|
||||
sact.version = 110;
|
||||
} else {
|
||||
sact.version = 120;
|
||||
|
||||
+2
-4
@@ -32,7 +32,7 @@
|
||||
#include "surface.h"
|
||||
#include "sacttimer.h"
|
||||
#include "variable.h"
|
||||
|
||||
#include "mmap.h"
|
||||
|
||||
// スプライトの最大数
|
||||
#define SPRITEMAX 21845
|
||||
@@ -63,9 +63,7 @@ typedef struct {
|
||||
|
||||
// SACTEFAM を使ったマスク
|
||||
typedef struct {
|
||||
int fd; // SACTEFAM.KLD のファイルディスクプリタ
|
||||
char *mapadr; // mmap された最初のアドレス
|
||||
off_t size; // mmap した大きさ
|
||||
mmap_t *mmap;
|
||||
int datanum; // SACTEFAM.KLD 中のマスクファイルの数
|
||||
int *no; // シナリオ側での番号
|
||||
int *offset; // データへのオフセット
|
||||
|
||||
@@ -27,11 +27,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
@@ -60,40 +55,21 @@ static ecopyparam_t ecp;
|
||||
|
||||
// SACTEFAM.KLD の読み込み
|
||||
int smask_init(char *path) {
|
||||
struct stat sbuf;
|
||||
int i, fd;
|
||||
char *adr;
|
||||
int i;
|
||||
SACTEFAM_t *am;
|
||||
|
||||
if (0 > (fd = open(path, O_RDONLY))) {
|
||||
WARNING("open: %s\n", strerror(errno));
|
||||
mmap_t *m = map_file(path);
|
||||
if (!m)
|
||||
return NG;
|
||||
}
|
||||
|
||||
if (0 > fstat(fd, &sbuf)) {
|
||||
WARNING("fstat: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return NG;
|
||||
}
|
||||
|
||||
if (MAP_FAILED == (adr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, fd, 0))) {
|
||||
WARNING("mmap: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return NG;
|
||||
}
|
||||
|
||||
am = &sact.am;
|
||||
am->mapadr = adr;
|
||||
am->size = sbuf.st_size;
|
||||
am->fd = fd;
|
||||
|
||||
am->datanum = LittleEndian_getDW(adr, 0);
|
||||
am->mmap = m;
|
||||
am->datanum = LittleEndian_getDW(m->addr, 0);
|
||||
am->no = malloc(sizeof(int) * am->datanum);
|
||||
am->offset = malloc(sizeof(int) * am->datanum);
|
||||
|
||||
for (i = 0; i < am->datanum; i++) {
|
||||
am->no[i] = LittleEndian_getDW(adr, 16 + i * 16);
|
||||
am->offset[i] = LittleEndian_getDW(adr, 16 + i * 16 + 8);
|
||||
am->no[i] = LittleEndian_getDW(m->addr, 16 + i * 16);
|
||||
am->offset[i] = LittleEndian_getDW(m->addr, 16 + i * 16 + 8);
|
||||
}
|
||||
|
||||
return OK;
|
||||
@@ -110,7 +86,7 @@ static surface_t *smask_get(int no) {
|
||||
|
||||
if (i == am->datanum) return NULL;
|
||||
|
||||
return sf_getcg(am->mapadr + am->offset[i]);
|
||||
return sf_getcg(am->mmap->addr + am->offset[i]);
|
||||
}
|
||||
|
||||
// ベースになるマスクの alpha 値を拡大して取り出す
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
#ifndef __SACTAMASK_H__
|
||||
#define __SACTAMASK_H__
|
||||
|
||||
extern int smask_init(char *path);
|
||||
extern int smask_init(const char *path);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -206,7 +206,7 @@ int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, int wText) {
|
||||
FONT *font;
|
||||
|
||||
if (0) {
|
||||
char *b = sjis2lang(v_str(wText-1));
|
||||
char *b = sjis2utf(v_str(wText-1));
|
||||
WARNING("str = '%s'\n", b);
|
||||
free(b);
|
||||
}
|
||||
|
||||
+21
-12
@@ -40,7 +40,17 @@
|
||||
#include "ngraph.h"
|
||||
#include "drawtext.h"
|
||||
#include "utfsjis.h"
|
||||
#include "sactlog_sjismsg.c"
|
||||
|
||||
#define LOGMSG_LINES 6
|
||||
|
||||
static const char *logmsg[LOGMSG_LINES] = {
|
||||
"\n",
|
||||
"※バックログ操作方法※",
|
||||
"[ESC]またはマウス右クリックでゲームに戻る",
|
||||
"[PageUp][PageDown]でページスクロール",
|
||||
"[↑][↓]またはマウスホイールで行スクロール",
|
||||
"\n",
|
||||
};
|
||||
|
||||
/*
|
||||
ホイールで上下スクロール
|
||||
@@ -73,21 +83,18 @@ static void draw_log() {
|
||||
// 表示始め位置
|
||||
node = list_nth(sact.log, list_length(sact.log) - curline);
|
||||
for (i = 0; i < LOGLINENUM; i++) {
|
||||
char *str, *streuc;
|
||||
if (cur <= 0) continue;
|
||||
|
||||
str = (char *)(node->data);
|
||||
char *str = (char *)(node->data);
|
||||
if (0 == strcmp(str, "\n")) {
|
||||
gr_fill(chr, 0, y + FONTSIZE/2, sf0->width, 3, 128, 0, 0);
|
||||
} else {
|
||||
streuc = sjis2lang(str);
|
||||
if (cur < 6) {
|
||||
dt_setfont(FONT_MINCHO, FONTSIZE);
|
||||
} else {
|
||||
dt_setfont(FONT_GOTHIC, FONTSIZE);
|
||||
}
|
||||
dt_drawtext(chr, 0, y, str);
|
||||
free(streuc);
|
||||
}
|
||||
y += FONTSIZE;
|
||||
cur--;
|
||||
@@ -103,13 +110,15 @@ static void draw_log() {
|
||||
|
||||
|
||||
int sblog_start(void) {
|
||||
static char *logmsg_sjis[6];
|
||||
if (!logmsg_sjis[0]) {
|
||||
for (int i = 0; i < LOGMSG_LINES; i++)
|
||||
logmsg_sjis[i] = utf2sjis(logmsg[i]);
|
||||
}
|
||||
|
||||
// 説明文章を追加
|
||||
sact.log = list_append(sact.log, "\n");
|
||||
sact.log = list_append(sact.log, LOGMSG1);
|
||||
sact.log = list_append(sact.log, LOGMSG2);
|
||||
sact.log = list_append(sact.log, LOGMSG3);
|
||||
sact.log = list_append(sact.log, LOGMSG4);
|
||||
sact.log = list_append(sact.log, "\n");
|
||||
for (int i = 0; i < LOGMSG_LINES; i++)
|
||||
sact.log = list_append(sact.log, logmsg_sjis[i]);
|
||||
|
||||
back = sf_dup(sf0);
|
||||
chr = sf_create_surface(sf0->width, sf0->height, 8);
|
||||
@@ -129,7 +138,7 @@ int sblog_end(void) {
|
||||
sf_free(chr);
|
||||
|
||||
// 説明文章を削除
|
||||
for (i = 0; i < 6; i++) {
|
||||
for (i = 0; i < LOGMSG_LINES; i++) {
|
||||
node = list_last(sact.log);
|
||||
sact.log = list_remove(sact.log, node->data);
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#define LOGMSG1 "※バックログ操作方法※"
|
||||
#define LOGMSG2 "[ESC]またはマウス右クリックでゲームに戻る"
|
||||
#define LOGMSG3 "[PageUp][PageDown]でページスクロール"
|
||||
#define LOGMSG4 "[↑][↓]またはマウスホイールで行スクロール"
|
||||
|
||||
@@ -83,7 +83,7 @@ extern void sp_draw_dmap(void* data, void* userdata);
|
||||
|
||||
|
||||
// in sprite_msg.c
|
||||
extern void smsg_add(char *msg);
|
||||
extern void smsg_add(const char *msg);
|
||||
extern void smsg_newline(int wNum, int size);
|
||||
extern void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wFont, int wSpeed, int wLineSpace, int wAlign, int wRSize, int wRFont, int wRLineSpace, int *wLength);
|
||||
extern void smsg_clear(int wNum);
|
||||
|
||||
@@ -188,13 +188,13 @@ static int setupmark(int wNum1, int wNum2, struct markinfo *minfo) {
|
||||
|
||||
@param msg: 追加する文字列
|
||||
*/
|
||||
void smsg_add(char *msg) {
|
||||
void smsg_add(const char *msg) {
|
||||
int len;
|
||||
|
||||
if (msg[0] == '\0') return;
|
||||
|
||||
if (0) {
|
||||
char *b = sjis2lang(msg);
|
||||
char *b = sjis2utf(msg);
|
||||
fprintf(stderr, "add msg '%s'\n", b);
|
||||
free(b);
|
||||
}
|
||||
@@ -305,7 +305,7 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
|
||||
dt_setfont(wFont, wSize);
|
||||
|
||||
if (0) {
|
||||
char *b = sjis2lang(mbuf);
|
||||
char *b = sjis2utf(mbuf);
|
||||
fprintf(stderr, "msg '%s'\n", b);
|
||||
free(b);
|
||||
}
|
||||
@@ -392,10 +392,10 @@ void smsg_clear(int wNum) {
|
||||
|
||||
/*
|
||||
出力中の文字列があるかチェック
|
||||
@return: なし(0) , あり(1)
|
||||
@return: なし(1) , あり(0)
|
||||
*/
|
||||
int smsg_is_empty() {
|
||||
return (sact.msgbuf[0] != '\0');
|
||||
return (sact.msgbuf[0] == '\0');
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -45,26 +45,8 @@ static void ExchangeString(void) {
|
||||
int target = getCaliValue();
|
||||
int pat = getCaliValue();
|
||||
int patr = getCaliValue();
|
||||
char *start = v_str(target -1);
|
||||
char *next;
|
||||
char dst[STRVAR_LEN] = "";
|
||||
|
||||
v_strReplaceAll(target - 1, pat - 1, patr - 1);
|
||||
DEBUG_COMMAND("ShString.ExchangeString: %d,%d,%d:\n", target, pat, patr);
|
||||
|
||||
if (v_strlen(target -1) == 0 || v_strlen(pat -1) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while(TRUE) {
|
||||
next = strstr(start, v_str(pat -1));
|
||||
if (next == NULL) break;
|
||||
strncat(dst, start, (size_t)(next - start));
|
||||
strncat(dst, v_str(patr -1), sizeof(dst) - strlen(dst));
|
||||
start = next + v_strlen(pat -1);
|
||||
}
|
||||
|
||||
strncat(dst, start, sizeof(dst) - strlen(dst));
|
||||
v_strcpy(target -1, dst);
|
||||
}
|
||||
|
||||
static void SetNum16String(void) { /* 1 */
|
||||
@@ -144,7 +126,7 @@ static void SetStringNum16(void) {
|
||||
*/
|
||||
int st = getCaliValue();
|
||||
int *var = getCaliVariable();
|
||||
char *str = v_str(st -1);
|
||||
const char *str = v_str(st -1);
|
||||
char _dst[100];
|
||||
char *dst = _dst;
|
||||
|
||||
|
||||
+11
-39
@@ -27,58 +27,31 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "LittleEndian.h"
|
||||
#include "alk.h"
|
||||
|
||||
alk_t *alk_new(char *path) {
|
||||
alk_t *alk_new(const char *path) {
|
||||
alk_t *alk;
|
||||
int i, fd;
|
||||
char *adr;
|
||||
struct stat sbuf;
|
||||
int i;
|
||||
|
||||
if (0 > (fd = open(path, O_RDONLY))) {
|
||||
WARNING("open: %s\n", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (0 > fstat(fd, &sbuf)) {
|
||||
WARNING("fstat: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
mmap_t *m = map_file(path);
|
||||
|
||||
if (MAP_FAILED == (adr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, fd, 0))) {
|
||||
WARNING("mmap: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (0 != strncmp(adr, "ALK0", 4)) {
|
||||
WARNING("mmap: %s\n", strerror(errno));
|
||||
munmap(adr, sbuf.st_size);
|
||||
close(fd);
|
||||
if (0 != strncmp(m->addr, "ALK0", 4)) {
|
||||
WARNING("%s: not an ALK file\n", path);
|
||||
unmap_file(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
alk = calloc(1, sizeof(alk_t));
|
||||
alk->mapadr = adr;
|
||||
alk->size = sbuf.st_size;
|
||||
alk->fd = fd;
|
||||
|
||||
alk->datanum = LittleEndian_getDW(adr, 4);
|
||||
alk->mmap = m;
|
||||
alk->datanum = LittleEndian_getDW(m->addr, 4);
|
||||
alk->offset = malloc(sizeof(int) * alk->datanum);
|
||||
|
||||
for (i = 0; i < alk->datanum; i++) {
|
||||
alk->offset[i] = LittleEndian_getDW(adr, 8 + i * 8);
|
||||
alk->offset[i] = LittleEndian_getDW(m->addr, 8 + i * 8);
|
||||
}
|
||||
|
||||
return alk;
|
||||
@@ -87,8 +60,7 @@ alk_t *alk_new(char *path) {
|
||||
int alk_free(alk_t *alk) {
|
||||
if (alk == NULL) return OK;
|
||||
|
||||
munmap(alk->mapadr, alk->size);
|
||||
close(alk->fd);
|
||||
unmap_file(alk->mmap);
|
||||
free(alk->offset);
|
||||
free(alk);
|
||||
|
||||
@@ -98,5 +70,5 @@ int alk_free(alk_t *alk) {
|
||||
char *alk_get(alk_t *alk, int no) {
|
||||
if (no >= alk->datanum) return NULL;
|
||||
|
||||
return alk->mapadr + alk->offset[no];
|
||||
return (char *)alk->mmap->addr + alk->offset[no];
|
||||
}
|
||||
|
||||
+3
-4
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include "mmap.h"
|
||||
|
||||
/*
|
||||
.ALK データ構造
|
||||
@@ -38,14 +39,12 @@
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
int fd; /* .alk ファイルの file discpriter */
|
||||
char *mapadr; /* mmap したファイルの先頭アドレス */
|
||||
off_t size; /* mmap したバイト数(ファイルサイズ) */
|
||||
mmap_t *mmap; /* mmap したファイル */
|
||||
int datanum; /* .alk ファイル中のファイル数 */
|
||||
int *offset; /* 各ファイルへのオフセット */
|
||||
} alk_t;
|
||||
|
||||
extern alk_t *alk_new(char *path);
|
||||
extern alk_t *alk_new(const char *path);
|
||||
extern int alk_free(alk_t *alk);
|
||||
extern char *alk_get(alk_t *alk, int no);
|
||||
|
||||
|
||||
+44
-45
@@ -16,13 +16,12 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#undef NDEBUG
|
||||
#include "list.h"
|
||||
#include <assert.h>
|
||||
#include "unittest.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static void list_func(void *data, void *user_data) {
|
||||
assert(*(int*)data == ++*(int*)user_data);
|
||||
ASSERT_EQUAL(*(int*)data, ++*(int*)user_data);
|
||||
}
|
||||
|
||||
static int compare_func(const void *a, const void *b) {
|
||||
@@ -36,18 +35,18 @@ int main() {
|
||||
// Basic
|
||||
{
|
||||
SList* l = NULL;
|
||||
assert(slist_length(l) == 0);
|
||||
ASSERT_EQUAL(slist_length(l), 0);
|
||||
|
||||
l = slist_append(l, &data1);
|
||||
assert(slist_length(l) == 1);
|
||||
assert(l->data == &data1);
|
||||
assert(slist_next(l) == NULL);
|
||||
ASSERT_EQUAL(slist_length(l), 1);
|
||||
ASSERT_EQUAL_PTR(l->data, &data1);
|
||||
ASSERT_NULL(slist_next(l));
|
||||
|
||||
l = slist_append(l, &data2);
|
||||
assert(slist_length(l) == 2);
|
||||
assert(l->data == &data1);
|
||||
assert(slist_next(l)->data == &data2);
|
||||
assert(slist_next(slist_next(l)) == NULL);
|
||||
ASSERT_EQUAL(slist_length(l), 2);
|
||||
ASSERT_EQUAL_PTR(l->data, &data1);
|
||||
ASSERT_EQUAL_PTR(slist_next(l)->data, &data2);
|
||||
ASSERT_NULL(slist_next(slist_next(l)));
|
||||
|
||||
slist_free(l);
|
||||
}
|
||||
@@ -55,20 +54,20 @@ int main() {
|
||||
// slist_nth, slist_last
|
||||
{
|
||||
SList* l = NULL;
|
||||
assert(slist_nth(l, 0) == NULL);
|
||||
assert(slist_nth(l, 1) == NULL);
|
||||
assert(slist_last(l) == NULL);
|
||||
ASSERT_NULL(slist_nth(l, 0));
|
||||
ASSERT_NULL(slist_nth(l, 1));
|
||||
ASSERT_NULL(slist_last(l));
|
||||
|
||||
l = slist_append(l, &data1);
|
||||
assert(slist_nth(l, 0)->data == &data1);
|
||||
assert(slist_nth(l, 1) == NULL);
|
||||
assert(slist_last(l) == slist_nth(l, 0));
|
||||
ASSERT_EQUAL_PTR(slist_nth(l, 0)->data, &data1);
|
||||
ASSERT_NULL(slist_nth(l, 1));
|
||||
ASSERT_EQUAL_PTR(slist_last(l), slist_nth(l, 0));
|
||||
|
||||
l = slist_append(l, &data2);
|
||||
assert(slist_nth(l, 0)->data == &data1);
|
||||
assert(slist_nth(l, 1)->data == &data2);
|
||||
assert(slist_nth(l, 2) == NULL);
|
||||
assert(slist_last(l) == slist_nth(l, 1));
|
||||
ASSERT_EQUAL_PTR(slist_nth(l, 0)->data, &data1);
|
||||
ASSERT_EQUAL_PTR(slist_nth(l, 1)->data, &data2);
|
||||
ASSERT_NULL(slist_nth(l, 2));
|
||||
ASSERT_EQUAL_PTR(slist_last(l), slist_nth(l, 1));
|
||||
|
||||
slist_free(l);
|
||||
}
|
||||
@@ -76,28 +75,28 @@ int main() {
|
||||
// slist_remove
|
||||
{
|
||||
SList* l = NULL;
|
||||
assert(slist_remove(l, NULL) == NULL);
|
||||
assert(slist_remove(l, &data1) == NULL);
|
||||
ASSERT_NULL(slist_remove(l, NULL));
|
||||
ASSERT_NULL(slist_remove(l, &data1));
|
||||
|
||||
l = slist_append(l, &data1);
|
||||
assert(slist_remove(l, NULL) == l);
|
||||
ASSERT_EQUAL_PTR(slist_remove(l, NULL), l);
|
||||
l = slist_remove(l, &data1);
|
||||
assert(l == NULL);
|
||||
ASSERT_NULL(l);
|
||||
|
||||
l = slist_append(l, &data1);
|
||||
l = slist_append(l, &data2);
|
||||
l = slist_append(l, &data1);
|
||||
l = slist_append(l, &data2);
|
||||
assert(slist_length(l) == 4);
|
||||
ASSERT_EQUAL(slist_length(l), 4);
|
||||
l = slist_remove(l, &data2);
|
||||
assert(slist_length(l) == 3);
|
||||
assert(slist_nth(l, 0)->data == &data1);
|
||||
assert(slist_nth(l, 1)->data == &data1);
|
||||
assert(slist_nth(l, 2)->data == &data2);
|
||||
ASSERT_EQUAL(slist_length(l), 3);
|
||||
ASSERT_EQUAL_PTR(slist_nth(l, 0)->data, &data1);
|
||||
ASSERT_EQUAL_PTR(slist_nth(l, 1)->data, &data1);
|
||||
ASSERT_EQUAL_PTR(slist_nth(l, 2)->data, &data2);
|
||||
l = slist_remove(l, &data2);
|
||||
assert(slist_length(l) == 2);
|
||||
assert(slist_nth(l, 0)->data == &data1);
|
||||
assert(slist_nth(l, 1)->data == &data1);
|
||||
ASSERT_EQUAL(slist_length(l), 2);
|
||||
ASSERT_EQUAL_PTR(slist_nth(l, 0)->data, &data1);
|
||||
ASSERT_EQUAL_PTR(slist_nth(l, 1)->data, &data1);
|
||||
|
||||
slist_free(l);
|
||||
}
|
||||
@@ -105,17 +104,17 @@ int main() {
|
||||
// slist_index
|
||||
{
|
||||
SList* l = NULL;
|
||||
assert(slist_index(l, NULL) == -1);
|
||||
assert(slist_index(l, &data1) == -1);
|
||||
ASSERT_EQUAL(slist_index(l, NULL), -1);
|
||||
ASSERT_EQUAL(slist_index(l, &data1), -1);
|
||||
|
||||
l = slist_append(l, &data1);
|
||||
assert(slist_index(l, NULL) == -1);
|
||||
assert(slist_index(l, &data1) == 0);
|
||||
ASSERT_EQUAL(slist_index(l, NULL), -1);
|
||||
ASSERT_EQUAL(slist_index(l, &data1), 0);
|
||||
|
||||
l = slist_append(l, &data1);
|
||||
l = slist_append(l, &data2);
|
||||
assert(slist_index(l, &data1) == 0);
|
||||
assert(slist_index(l, &data2) == 2);
|
||||
ASSERT_EQUAL(slist_index(l, &data1), 0);
|
||||
ASSERT_EQUAL(slist_index(l, &data2), 2);
|
||||
|
||||
slist_free(l);
|
||||
}
|
||||
@@ -127,7 +126,7 @@ int main() {
|
||||
l = slist_append(l, &data2);
|
||||
int count = 0;
|
||||
slist_foreach(l, list_func, &count);
|
||||
assert(count == 2);
|
||||
ASSERT_EQUAL(count, 2);
|
||||
slist_free(l);
|
||||
}
|
||||
|
||||
@@ -140,11 +139,11 @@ int main() {
|
||||
l = slist_insert_sorted(l, &data3, compare_func);
|
||||
l = slist_insert_sorted(l, &data0, compare_func);
|
||||
l = slist_insert_sorted(l, &data2, compare_func);
|
||||
assert(slist_length(l) == 4);
|
||||
assert(slist_nth(l, 0)->data == &data0);
|
||||
assert(slist_nth(l, 1)->data == &data1);
|
||||
assert(slist_nth(l, 2)->data == &data2);
|
||||
assert(slist_nth(l, 3)->data == &data3);
|
||||
ASSERT_EQUAL(slist_length(l), 4);
|
||||
ASSERT_EQUAL_PTR(slist_nth(l, 0)->data, &data0);
|
||||
ASSERT_EQUAL_PTR(slist_nth(l, 1)->data, &data1);
|
||||
ASSERT_EQUAL_PTR(slist_nth(l, 2)->data, &data2);
|
||||
ASSERT_EQUAL_PTR(slist_nth(l, 3)->data, &data3);
|
||||
|
||||
slist_free(l);
|
||||
}
|
||||
|
||||
+33
-6
@@ -1,10 +1,20 @@
|
||||
add_library(src_lib STATIC
|
||||
gameresource.c
|
||||
hankaku.c
|
||||
utfsjis.c
|
||||
)
|
||||
target_compile_options(src_lib PRIVATE -Wno-pointer-sign)
|
||||
target_include_directories(src_lib PRIVATE .)
|
||||
|
||||
if (ANDROID)
|
||||
add_library(xsystem35 SHARED)
|
||||
else()
|
||||
add_executable(xsystem35)
|
||||
endif()
|
||||
|
||||
target_compile_options(xsystem35 PRIVATE -Wno-pointer-sign -Wno-invalid-source-encoding)
|
||||
target_compile_options(xsystem35 PRIVATE -Wno-pointer-sign)
|
||||
target_include_directories(xsystem35 PRIVATE .)
|
||||
target_link_libraries(xsystem35 PRIVATE src_lib)
|
||||
|
||||
target_sources(xsystem35 PRIVATE
|
||||
xsystem35.c
|
||||
@@ -28,6 +38,10 @@ target_sources(xsystem35 PRIVATE
|
||||
# CG
|
||||
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)
|
||||
endif()
|
||||
|
||||
# Music
|
||||
target_sources(xsystem35 PRIVATE
|
||||
@@ -35,13 +49,12 @@ target_sources(xsystem35 PRIVATE
|
||||
|
||||
# Misc
|
||||
target_sources(xsystem35 PRIVATE
|
||||
LittleEndian.c counter.c input.c profile.c mt19937-1.c utfsjis.c
|
||||
filecheck.c)
|
||||
LittleEndian.c counter.c input.c profile.c mt19937-1.c filecheck.c mmap.c)
|
||||
|
||||
# Scenario
|
||||
target_sources(xsystem35 PRIVATE
|
||||
cali.c scenario.c variable.c cmd_check.c hankana2sjis.c nact.c
|
||||
selection.c message.c savedata.c hankaku.c s39ain.c texthook.c)
|
||||
cali.c scenario.c variable.c cmd_check.c nact.c
|
||||
selection.c message.c savedata.c s39ain.c texthook.c)
|
||||
|
||||
# Graphics
|
||||
target_sources(xsystem35 PRIVATE
|
||||
@@ -51,6 +64,10 @@ target_sources(xsystem35 PRIVATE
|
||||
target_sources(xsystem35 PRIVATE
|
||||
network.c)
|
||||
|
||||
if (WIN32)
|
||||
target_sources(xsystem35 PRIVATE win/dialog.c win/resources.rc)
|
||||
endif()
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
|
||||
set(LIBS "SHELL:-s USE_ZLIB=1 -s USE_FREETYPE=1 -s USE_SDL=2")
|
||||
@@ -89,7 +106,7 @@ else() # non-emscripten, non-android
|
||||
if (FREETYPE_FOUND)
|
||||
target_link_libraries(xsystem35 PRIVATE Freetype::Freetype)
|
||||
endif()
|
||||
if (SDL2_FOUND)
|
||||
if (ENABLE_SDL)
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::SDL2)
|
||||
endif()
|
||||
if (SDL2MIXER_FOUND)
|
||||
@@ -100,6 +117,16 @@ else() # non-emscripten, non-android
|
||||
endif()
|
||||
|
||||
install(TARGETS xsystem35 RUNTIME DESTINATION bin)
|
||||
|
||||
add_executable(src_tests
|
||||
src_tests.c
|
||||
gameresource_test.c
|
||||
hankaku_test.c
|
||||
)
|
||||
target_compile_options(src_tests PRIVATE -Wno-pointer-sign)
|
||||
target_link_libraries(src_tests PRIVATE src_lib)
|
||||
add_test(NAME src_tests COMMAND src_tests)
|
||||
configure_file(testdata/test.gr ${CMAKE_CURRENT_BINARY_DIR}/testdata/test.gr COPYONLY)
|
||||
endif()
|
||||
|
||||
# FIXME: set up dependency for xsystem35 on this
|
||||
|
||||
@@ -184,11 +184,11 @@ void ags_setViewArea(int x, int y, int width, int height) {
|
||||
SetWindowSize(x, y, width, height);
|
||||
}
|
||||
|
||||
void ags_setWindowTitle(char *src) {
|
||||
void ags_setWindowTitle(const char *src) {
|
||||
#define TITLEHEAD "XSystem35 Version "VERSION":"
|
||||
BYTE *dst, *d;
|
||||
|
||||
dst = sjis2lang(src);
|
||||
dst = sjis2utf(src);
|
||||
if (NULL == (d = malloc(strlen(dst) + strlen(TITLEHEAD) + 1))) {
|
||||
NOMEMERR();
|
||||
}
|
||||
@@ -396,7 +396,7 @@ void ags_delRegion(void *region) {
|
||||
DelRegion(region);
|
||||
}
|
||||
|
||||
int ags_drawString(int x, int y, char *src, int col) {
|
||||
int ags_drawString(int x, int y, const char *src, int col) {
|
||||
int w;
|
||||
|
||||
if (!check_param_xy(&x, &y)) return 0;
|
||||
|
||||
@@ -33,19 +33,19 @@
|
||||
|
||||
|
||||
/* マウスカーソルの種類 */
|
||||
#define IDC_ARROW 1
|
||||
#define IDC_CROSS 2
|
||||
#define IDC_IBEAM 3
|
||||
#define IDC_ICON 4
|
||||
#define IDC_NO 5
|
||||
#define IDC_SIZE 6
|
||||
#define IDC_SIZEALL 7
|
||||
#define IDC_SIZENESW 8
|
||||
#define IDC_SIZENS 9
|
||||
#define IDC_SIZENWSE 10
|
||||
#define IDC_SIZEWE 11
|
||||
#define IDC_UPARROW 12
|
||||
#define IDC_WAIT 13
|
||||
#define CURSOR_ARROW 1
|
||||
#define CURSOR_CROSS 2
|
||||
#define CURSOR_IBEAM 3
|
||||
#define CURSOR_ICON 4
|
||||
#define CURSOR_NO 5
|
||||
#define CURSOR_SIZE 6
|
||||
#define CURSOR_SIZEALL 7
|
||||
#define CURSOR_SIZENESW 8
|
||||
#define CURSOR_SIZENS 9
|
||||
#define CURSOR_SIZENWSE 10
|
||||
#define CURSOR_SIZEWE 11
|
||||
#define CURSOR_UPARROW 12
|
||||
#define CURSOR_WAIT 13
|
||||
|
||||
/* RGB <-> alpha plane copy type */
|
||||
typedef enum {
|
||||
@@ -151,7 +151,7 @@ extern void ags_remove();
|
||||
/* ウィンド関係 */
|
||||
extern void ags_setWorldSize(int width, int height, int depth);
|
||||
extern void ags_setViewArea(int x, int y, int width, int height);
|
||||
extern void ags_setWindowTitle(char *str);
|
||||
extern void ags_setWindowTitle(const char *str);
|
||||
extern void ags_getDIBInfo(DispInfo *info);
|
||||
extern void ags_getWindowInfo(DispInfo *info);
|
||||
extern void ags_getViewAreaInfo(DispInfo *info);
|
||||
@@ -194,7 +194,7 @@ extern void ags_putRegion(void *region, int x, int y);
|
||||
extern void ags_copyRegion(void *region, int sx, int sy, int w,int h,int dx,int dy);
|
||||
extern void ags_delRegion(void *region);
|
||||
|
||||
extern int ags_drawString(int x, int y, char *src, int col);
|
||||
extern int ags_drawString(int x, int y, const char *src, int col);
|
||||
extern void ags_drawCg8bit(cgdata *cg, int x, int y);
|
||||
extern void ags_drawCg16bit(cgdata *cg, int x, int y);
|
||||
|
||||
|
||||
+6
-8
@@ -101,14 +101,12 @@ void ald_freedata(dridata *data) {
|
||||
* type: data type
|
||||
* file: file name array
|
||||
* cnt : number in file name array
|
||||
* mmap: mmap file or not
|
||||
*/
|
||||
void ald_init(int type, char **file, int cnt, boolean mmap) {
|
||||
/* check wrong type */
|
||||
if (type < DRIFILETYPEMAX) {
|
||||
dri[type] = dri_init(file, cnt, mmap);
|
||||
if (!dri[type]->mmapped) {
|
||||
cacheid = cache_new(ald_free);
|
||||
}
|
||||
void ald_init(int type, const char **file, int cnt) {
|
||||
if (type >= DRIFILETYPEMAX || cnt <= 0)
|
||||
return;
|
||||
dri[type] = dri_init(file, cnt);
|
||||
if (!dri[type]->mmapped) {
|
||||
cacheid = cache_new(ald_free);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ typedef enum {
|
||||
DRIFILE_BGM =6 /* stream music data */
|
||||
} DRIFILETYPE;
|
||||
|
||||
extern void ald_init(int type, char **file, int cnt, boolean mmap);
|
||||
extern void ald_init(int type, const char **file, int cnt);
|
||||
extern dridata *ald_getdata(DRIFILETYPE type, int no);
|
||||
extern void ald_freedata(dridata *data);
|
||||
|
||||
|
||||
+19
-28
@@ -64,52 +64,44 @@ static int *fixOffset(int base, int offset2) {
|
||||
int page, offset;
|
||||
int *index;
|
||||
|
||||
preVarPage = (sysVarAttribute + base) -> page;
|
||||
preVarPage = sysVarAttribute[base].page;
|
||||
preVarNo = base;
|
||||
if ((sysVarAttribute + base) -> page == 0) {
|
||||
if (sysVarAttribute[base].page == 0) {
|
||||
if (offset2 == -1) {
|
||||
#ifdef DEBUG_CHECKALING
|
||||
if (base >= SYSVAR_MAX) {
|
||||
WARNING("sysVar[no] ArrayIndexOutofException (%d, %d)\n", base, offset2);
|
||||
WARNING("%03d:%05x: ArrayIndexOutOfBounds (%d, %d)\n", sl_getPage(), sl_getIndex(), base, offset2);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
preVarIndex = base;
|
||||
return sysVar + base;
|
||||
} else {
|
||||
#ifdef DEBUG_CHECKALING
|
||||
if ((base + offset2) >= SYSVAR_MAX) {
|
||||
WARNING("sysVar[no] ArrayIndexOutofException (%d, %d)\n", base, offset2);
|
||||
WARNING("%03d:%05x: ArrayIndexOutOfBounds (%d, %d)\n", sl_getPage(), sl_getIndex(), base, offset2);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
preVarIndex = base + offset2;
|
||||
return sysVar + base + offset2;
|
||||
}
|
||||
} else {
|
||||
if (offset2 == -1) {
|
||||
index = (sysVarAttribute + base) -> pointvar;
|
||||
page = (sysVarAttribute + base) -> page;
|
||||
offset = (sysVarAttribute + base) -> offset;
|
||||
#ifdef DEBUG_CHECKALING
|
||||
if ((*index) + offset > (arrayVarBuffer + page - 1)->max) {
|
||||
WARNING("sysVar[no] ArrayIndexOutofException (%d, %d, %d, %d, %d)\n", base, offset2, *index, page, offset);
|
||||
index = sysVarAttribute[base].pointvar;
|
||||
page = sysVarAttribute[base].page;
|
||||
offset = sysVarAttribute[base].offset;
|
||||
if (*index + offset >= arrayVarBuffer[page - 1].size) {
|
||||
WARNING("%03d:%05x: ArrayIndexOutOfBounds (%d, %d, %d, %d, %d)\n", sl_getPage(), sl_getIndex(), base, offset2, *index, page, offset);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
preVarIndex = offset + (*index);
|
||||
return ((arrayVarBuffer + page - 1) -> value) + offset + (*index);
|
||||
preVarIndex = offset + *index;
|
||||
return arrayVarBuffer[page - 1].value + offset + *index;
|
||||
} else {
|
||||
page = (sysVarAttribute + base) -> page;
|
||||
offset = (sysVarAttribute + base) -> offset;
|
||||
#ifdef DEBUG_CHECKALING
|
||||
if (offset + offset2 > (arrayVarBuffer + page - 1)->max) {
|
||||
WARNING("sysVar[no] ArrayIndexOutofException (%d, %d, %d, %d)\n", base, offset2, page, offset);
|
||||
page = sysVarAttribute[base].page;
|
||||
offset = sysVarAttribute[base].offset;
|
||||
if (offset + offset2 >= arrayVarBuffer[page - 1].size) {
|
||||
WARNING("%03d:%05x: ArrayIndexOutOfBounds (%d, %d, %d, %d)\n", sl_getPage(), sl_getIndex(), base, offset2, page, offset);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
preVarIndex = offset + offset2;
|
||||
return ((arrayVarBuffer + page - 1) -> value) + offset + offset2;
|
||||
return arrayVarBuffer[page - 1].value + offset + offset2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,8 +195,7 @@ int getCaliValue() {
|
||||
}
|
||||
l_var:
|
||||
t = getVar(c0);
|
||||
if (t == NULL) continue;
|
||||
*cali = *t; cali++;
|
||||
*cali++ = t ? *t : 0;
|
||||
} else {
|
||||
switch(c0) {
|
||||
case 0x7e: /* != */
|
||||
@@ -304,12 +295,12 @@ int getCaliValue() {
|
||||
}
|
||||
}
|
||||
c0 = *--cali;
|
||||
#ifdef DEBUG_CHECKALING
|
||||
|
||||
if (cali != bufc) {
|
||||
WARNING("Something is wrong @ %03d:%05x\n", sl_getPage(), sl_getIndex());
|
||||
cali = bufc;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return c0;
|
||||
}
|
||||
|
||||
+3
-5
@@ -92,18 +92,16 @@ int cd_init(cdromdevice_t *cd) {
|
||||
memcpy(cd, DEV_PLAY_MODE, sizeof(cdromdevice_t));
|
||||
ret = cd->init(dev);
|
||||
}
|
||||
else {
|
||||
#ifdef ENABLE_CDROM_MP3
|
||||
else if (S_ISREG(st.st_mode)) {
|
||||
/* MP3 MODE */
|
||||
memcpy(cd, &cdrom_mp3, sizeof(cdromdevice_t));
|
||||
ret = cd->init(dev);
|
||||
memcpy(cd, &cdrom_mp3, sizeof(cdromdevice_t));
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
#else
|
||||
/* error */
|
||||
WARNING("no cdrom device available\n");
|
||||
ret = NG;
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
#endif // ENABLE_CDROM_EMSCRIPTEN || ENABLE_CDROM_ANDROID
|
||||
|
||||
+11
-6
@@ -89,15 +89,20 @@ static int trackno; // 現在演奏中のトラック
|
||||
static int counter; // 演奏時間測定用カウンタ
|
||||
|
||||
static int cdrom_init(char *config_file) {
|
||||
FILE *fp;
|
||||
char lbuf[256];
|
||||
int lcnt = 0;
|
||||
int lcnt = 1;
|
||||
char *s;
|
||||
|
||||
if (NULL == (fp = fopen(config_file, "rt"))) return NG;
|
||||
// Skip the first line
|
||||
fgets(lbuf, sizeof(lbuf), fp); lcnt++;
|
||||
|
||||
FILE *fp = fopen(config_file, "rt");
|
||||
if (fp) {
|
||||
// Skip the first line
|
||||
fgets(lbuf, sizeof(lbuf), fp);
|
||||
} else {
|
||||
fp = fopen("_inmm.ini", "rt");
|
||||
}
|
||||
if (!fp)
|
||||
return NG;
|
||||
|
||||
while (TRUE) {
|
||||
if (++lcnt >= (PLAYLIST_MAX +2)) {
|
||||
break;
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
#include "pms.h"
|
||||
#include "bmp.h"
|
||||
#include "qnt.h"
|
||||
#ifdef HAVE_JPEG
|
||||
#include "jpeg.h"
|
||||
#endif
|
||||
#include "ald_manager.h"
|
||||
#include "savedata.h"
|
||||
#include "cache.h"
|
||||
@@ -85,6 +88,10 @@ static CG_TYPE check_cgformat(BYTE *data) {
|
||||
return ALCG_BMP8;
|
||||
} else if (vsp_checkfmt(data)) {
|
||||
return ALCG_VSP;
|
||||
#ifdef HAVE_JPEG
|
||||
} else if (jpeg_checkfmt(data) && nact->sys_world_depth >= 15) {
|
||||
return ALCG_JPEG;
|
||||
#endif
|
||||
}
|
||||
WARNING("Unknown Cg Type\n");
|
||||
return ALCG_UNKNOWN;
|
||||
@@ -182,6 +189,7 @@ static void display_cg(cgdata *cg, int x, int y) {
|
||||
ags_drawCg8bit(cg, x, y); break;
|
||||
case ALCG_PMS16:
|
||||
case ALCG_BMP24:
|
||||
case ALCG_JPEG:
|
||||
ags_drawCg16bit(cg, x, y); break;
|
||||
default:
|
||||
break;
|
||||
@@ -243,6 +251,12 @@ static cgdata *loader(int no) {
|
||||
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;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -395,6 +409,7 @@ void cg_load(int no, int flg) {
|
||||
break;
|
||||
case ALCG_PMS16:
|
||||
case ALCG_BMP24:
|
||||
case ALCG_JPEG:
|
||||
if (GCMD_EXTRACTCG(cg_fflg)) {
|
||||
/* set display offset */
|
||||
p = set_display_loc(cg);
|
||||
@@ -461,13 +476,14 @@ void cg_load_with_alpha(int cgno, int shadowno) {
|
||||
* y : display location y
|
||||
* return: file read status
|
||||
*/
|
||||
int cg_load_with_filename(char *name, int x, int y) {
|
||||
int cg_load_with_filename(char *fname_utf8, int x, int y) {
|
||||
int status, type;
|
||||
long filesize;
|
||||
BYTE *data;
|
||||
cgdata *cg = NULL;
|
||||
MyPoint p;
|
||||
|
||||
data = load_cg_with_file(name, &status);
|
||||
data = load_cg_with_file(fname_utf8, &status, &filesize);
|
||||
if (data == NULL) return status;
|
||||
|
||||
cg_set_display_location(x, y, OFFSET_ABSOLUTE_GC);
|
||||
@@ -480,6 +496,11 @@ int cg_load_with_filename(char *name, int x, int y) {
|
||||
case ALCG_BMP24:
|
||||
cg = bmp16m_extract(data);
|
||||
break;
|
||||
#ifdef HAVE_JPEG
|
||||
case ALCG_JPEG:
|
||||
cg = jpeg_extract(data, filesize);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ typedef enum {
|
||||
ALCG_PMS16 = 4,
|
||||
ALCG_BMP8 = 5,
|
||||
ALCG_BMP24 = 6,
|
||||
ALCG_QNT = 7
|
||||
ALCG_QNT = 7,
|
||||
ALCG_JPEG = 8,
|
||||
} CG_TYPE;
|
||||
|
||||
/*
|
||||
@@ -78,7 +79,7 @@ extern void cg_init();
|
||||
extern void cg_set_display_location(int x, int y, CG_WHERETODISP policy);
|
||||
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 *name, int x, int y);
|
||||
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();
|
||||
|
||||
+36
-51
@@ -33,10 +33,12 @@
|
||||
#include "message.h"
|
||||
#include "music.h"
|
||||
#include "utfsjis.h"
|
||||
#include "hankaku.h"
|
||||
#include "ags.h"
|
||||
#include "graphicsdevice.h"
|
||||
#include "ald_manager.h"
|
||||
#include "LittleEndian.h"
|
||||
#include "gametitle.h"
|
||||
#if HAVE_UNAME
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
@@ -365,7 +367,9 @@ void commands2F23() {
|
||||
int y = getCaliValue();
|
||||
char *vFileName = sys_getString(0);
|
||||
|
||||
sysVar[0] = cg_load_with_filename(vFileName, x, y);
|
||||
char *fname_utf8 = sjis2utf(vFileName);
|
||||
sysVar[0] = cg_load_with_filename(fname_utf8, x, y);
|
||||
free(fname_utf8);
|
||||
|
||||
DEBUG_COMMAND("LC(new) %d, %d, %s:\n", x, y, vFileName);
|
||||
}
|
||||
@@ -376,18 +380,20 @@ void commands2F24() {
|
||||
int *var = NULL, _var = 0;
|
||||
int num = 0;
|
||||
|
||||
char *fname_utf8 = sjis2utf(file_name);
|
||||
switch(type) {
|
||||
case 0:
|
||||
var = getCaliVariable();
|
||||
num = getCaliValue();
|
||||
sysVar[0] = save_load_var_with_file(file_name, var, num);
|
||||
sysVar[0] = save_load_var_with_file(fname_utf8, var, num);
|
||||
break;
|
||||
case 1:
|
||||
_var = getCaliValue();
|
||||
num = getCaliValue();
|
||||
sysVar[0] = save_load_str_with_file(file_name, _var, num);
|
||||
sysVar[0] = save_load_str_with_file(fname_utf8, _var, num);
|
||||
break;
|
||||
}
|
||||
free(fname_utf8);
|
||||
|
||||
DEBUG_COMMAND("LE(new) %d, %s, %d, %d:\n", type, file_name, var, num);
|
||||
}
|
||||
@@ -406,8 +412,8 @@ void commands2F26() {
|
||||
char *title = sys_getString(0);
|
||||
char *t1, *t2, *t3;
|
||||
|
||||
t1 = sjis2lang(title);
|
||||
t2 = sjis2lang(v_str(dst_no -1));
|
||||
t1 = sjis2utf(title);
|
||||
t2 = sjis2utf(v_str(dst_no -1));
|
||||
|
||||
mi_param.title = t1;
|
||||
mi_param.oldstring = t2;
|
||||
@@ -420,7 +426,7 @@ void commands2F26() {
|
||||
return;
|
||||
}
|
||||
|
||||
t3 = lang2sjis(mi_param.newstring);
|
||||
t3 = utf2sjis(mi_param.newstring);
|
||||
|
||||
/* 全角文字以外は不可 */
|
||||
if (!sjis_has_hankaku(t3)) {
|
||||
@@ -449,10 +455,14 @@ void commands2F27() {
|
||||
void commands2F28() {
|
||||
char *title = sys_getString(0);
|
||||
|
||||
strncpy(nact->game_title_name, title, 30);
|
||||
if (nact->game_title_utf8)
|
||||
free(nact->game_title_utf8);
|
||||
nact->game_title_utf8 = sjis2utf(title);
|
||||
|
||||
ags_setWindowTitle(title);
|
||||
|
||||
if (0 == strcmp(title, GT_RANCE3_ENG) || 0 == strcmp(title, GT_RANCE4_ENG)) {
|
||||
if (0 == strcmp(nact->game_title_utf8, GT_RANCE3_ENG) ||
|
||||
0 == strcmp(nact->game_title_utf8, GT_RANCE4_ENG)) {
|
||||
have_eng_mp_patch = TRUE;
|
||||
}
|
||||
|
||||
@@ -468,7 +478,7 @@ void commands2F29() {
|
||||
if (ni_param.title != NULL) {
|
||||
free(ni_param.title);
|
||||
}
|
||||
t = sjis2lang(title);
|
||||
t = sjis2utf(title);
|
||||
ni_param.title = t;
|
||||
|
||||
DEBUG_COMMAND("NT(new) %s:\n", title);
|
||||
@@ -479,20 +489,23 @@ void commands2F2A() {
|
||||
char *file_name = sys_getString(0);
|
||||
int *var, _var = 0, cnt;
|
||||
|
||||
char *fname_utf8 = sjis2utf(file_name);
|
||||
switch(type) {
|
||||
case 0:
|
||||
var = getCaliVariable();
|
||||
cnt = getCaliValue();
|
||||
sysVar[0] = save_save_var_with_file(file_name, var, cnt);
|
||||
sysVar[0] = save_save_var_with_file(fname_utf8, var, cnt);
|
||||
break;
|
||||
case 1:
|
||||
_var = getCaliValue();
|
||||
cnt = getCaliValue();
|
||||
sysVar[0] = save_save_str_with_file(file_name, _var, cnt);
|
||||
sysVar[0] = save_save_str_with_file(fname_utf8, _var, cnt);
|
||||
break;
|
||||
default:
|
||||
WARNING("Unknown QE command\n"); return;
|
||||
WARNING("Unknown QE command\n");
|
||||
break;
|
||||
}
|
||||
free(fname_utf8);
|
||||
|
||||
DEBUG_COMMAND("QE(new) %d, %s, %d, %d:\n", type, file_name, _var, cnt);
|
||||
}
|
||||
@@ -639,22 +652,7 @@ void commands2F3C() {
|
||||
int ePos = getCaliValue();
|
||||
int *vResult = getCaliVariable();
|
||||
|
||||
if (eNum <= 0 || v_strlen(eNum -1) < ePos) {
|
||||
*vResult = 0;
|
||||
} else {
|
||||
BYTE b1, b2 = 0;
|
||||
b1 = *(v_str(eNum - 1) + ePos);
|
||||
if (ePos == 0) {
|
||||
*vResult = CHECKSJIS1BYTE(b1) ? 2 : 1;
|
||||
} else {
|
||||
b2 = *(v_str(eNum - 1) + ePos -1);
|
||||
if (CHECKSJIS1BYTE(b1)) {
|
||||
*vResult = 2;
|
||||
} else {
|
||||
*vResult = CHECKSJIS1BYTE(b2) ? 2 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
*vResult = v_strGetCharType(eNum - 1, ePos);
|
||||
|
||||
DEBUG_COMMAND("strGetCharType %d, %d, %d:\n", eNum, ePos, *vResult);
|
||||
}
|
||||
@@ -663,7 +661,7 @@ void commands2F3D() {
|
||||
int eNum = getCaliValue();
|
||||
int *vResult = getCaliVariable();
|
||||
|
||||
*vResult = v_strlen(eNum -1);
|
||||
*vResult = v_strWidth(eNum -1);
|
||||
|
||||
DEBUG_COMMAND("strGetLengthASCII %d, %d:\n", eNum, *vResult);
|
||||
}
|
||||
@@ -746,17 +744,9 @@ void commands2F44() {
|
||||
int num1 = getCaliValue();
|
||||
int fig = getCaliValue();
|
||||
int num2 = getCaliValue();
|
||||
char s[256];
|
||||
char buf[256];
|
||||
|
||||
if (fig) {
|
||||
char *ss="%%%dd";
|
||||
char sss[256];
|
||||
sprintf(sss, ss, fig);
|
||||
sprintf(s, sss, num2);
|
||||
} else {
|
||||
sprintf(s, "%d", num2);
|
||||
}
|
||||
v_strcpy(num1 - 1, s);
|
||||
v_strcpy(num1 - 1, format_number(num2, fig, buf));
|
||||
|
||||
DEBUG_COMMAND("MHH %d, %d, %d:\n", num1, fig, num2);
|
||||
}
|
||||
@@ -934,8 +924,8 @@ void commands2F57() {
|
||||
char *t1, *t2, *t3;
|
||||
INPUTSTRING_PARAM p;
|
||||
|
||||
t1 = sjis2lang(sTitle);
|
||||
t2 = sjis2lang(v_str(eStrVar -1));
|
||||
t1 = sjis2utf(sTitle);
|
||||
t2 = sjis2utf(v_str(eStrVar -1));
|
||||
p.title = t1;
|
||||
p.oldstring = t2;
|
||||
p.max = eLength;
|
||||
@@ -944,7 +934,7 @@ void commands2F57() {
|
||||
if (p.newstring == NULL) {
|
||||
*vResult = 65535;
|
||||
} else {
|
||||
t3 = lang2sjis(p.newstring);
|
||||
t3 = utf2sjis(p.newstring);
|
||||
if (!sjis_has_hankaku(t3)) {
|
||||
v_strcpy(eStrVar -1, t3);
|
||||
*vResult = sjis_count_char(t3);
|
||||
@@ -963,7 +953,7 @@ void commands2F58() {
|
||||
int eNum = getCaliValue();
|
||||
int *vResult = getCaliVariable();
|
||||
|
||||
*vResult = sjis_has_hankaku(v_str(eNum) -1) ? 1 : 0;
|
||||
*vResult = sjis_has_hankaku(v_str(eNum - 1)) ? 1 : 0;
|
||||
|
||||
DEBUG_COMMAND("strCheckASCII %d, %d:\n", eNum, *vResult);
|
||||
}
|
||||
@@ -972,7 +962,7 @@ void commands2F59() {
|
||||
int eNum = getCaliValue();
|
||||
int *vResult = getCaliVariable();
|
||||
|
||||
*vResult = sjis_has_zenkaku(v_str(eNum) -1) ? 1 : 0;
|
||||
*vResult = sjis_has_zenkaku(v_str(eNum - 1)) ? 1 : 0;
|
||||
|
||||
DEBUG_COMMAND("strCheckSJIS %d, %d:\n", eNum, *vResult);
|
||||
}
|
||||
@@ -981,7 +971,7 @@ void commands2F5A() {
|
||||
char *sText = sys_getString(0);
|
||||
char *t1;
|
||||
|
||||
t1 = sjis2lang(sText);
|
||||
t1 = sjis2utf(sText);
|
||||
menu_msgbox_open(t1);
|
||||
free(t1);
|
||||
|
||||
@@ -992,7 +982,7 @@ void commands2F5B() {
|
||||
int eNum = getCaliValue();
|
||||
char *t1;
|
||||
|
||||
t1 = sjis2lang(v_str(eNum) - 1);
|
||||
t1 = sjis2utf(v_str(eNum) - 1);
|
||||
menu_msgbox_open(t1);
|
||||
free(t1);
|
||||
|
||||
@@ -1350,9 +1340,7 @@ void commands2F7D() {
|
||||
int index = sys_getdw();
|
||||
|
||||
commandH();
|
||||
sys_addMsg(nact->ain.msg[index]);
|
||||
|
||||
// DEBUG_COMMAND_YET("2F7D %d, %d, %d:\n", index, page, p1);
|
||||
DEBUG_COMMAND("2F7D %d:\n", index);
|
||||
}
|
||||
|
||||
@@ -1360,9 +1348,7 @@ void commands2F7E() {
|
||||
int index = sys_getdw();
|
||||
|
||||
commandHH();
|
||||
sys_addMsg(nact->ain.msg[index]);
|
||||
|
||||
//DEBUG_COMMAND_YET("2F7E %d, %d, %d:\n", index, p1, p2);
|
||||
DEBUG_COMMAND("2F7E %d:\n", index);
|
||||
}
|
||||
|
||||
@@ -1371,7 +1357,6 @@ void commands2F7F() {
|
||||
int p1 = sys_getCaliValue();
|
||||
|
||||
sys_addMsg(v_str(p1 -1));
|
||||
sys_addMsg(nact->ain.msg[index]);
|
||||
|
||||
DEBUG_COMMAND("2F7F %d, %d(%s,%s):\n", index, p1, nact->ain.msg[index], v_str(p1 -1));
|
||||
}
|
||||
|
||||
+17
-7
@@ -28,26 +28,26 @@
|
||||
|
||||
void commandDC() {
|
||||
int page = getCaliValue();
|
||||
int size = getCaliValue();
|
||||
int maxindex = getCaliValue();
|
||||
int save = getCaliValue();
|
||||
boolean bool;
|
||||
|
||||
bool = v_allocateArrayBuffer(page , size, save == 0 ? false : true);
|
||||
bool = v_allocateArrayBuffer(page, maxindex + 1, save == 0 ? false : true);
|
||||
if(!bool) {
|
||||
WARNING("commandDC(): Array allocate failed\n");
|
||||
}
|
||||
DEBUG_COMMAND("DC %d,%d,%d:\n", page, size, save);
|
||||
DEBUG_COMMAND("DC %d,%d,%d:\n", page, maxindex, save);
|
||||
}
|
||||
|
||||
void commandDI() {
|
||||
int page = getCaliValue();
|
||||
int *var_use = getCaliVariable();
|
||||
int *var_size = getCaliVariable();
|
||||
int *var_save = getCaliVariable();
|
||||
|
||||
*var_size = v_releaseArrayVar(page);
|
||||
*var_save = v_getArrayBufferCnt(page) == true ? 1 : 0;
|
||||
*var_use = v_getArrayBufferStatus(page);
|
||||
*var_size = arrayVarBuffer[page - 1].size & 0xffff;
|
||||
|
||||
DEBUG_COMMAND("DI %d,%p,%p:\n", page, var_size, var_save);
|
||||
DEBUG_COMMAND("DI %d,%p,%p:\n", page, var_use, var_size);
|
||||
}
|
||||
|
||||
void commandDS() {
|
||||
@@ -76,11 +76,21 @@ void commandDR() {
|
||||
|
||||
void commandDF() {
|
||||
int *data_var = getCaliVariable();
|
||||
int varno = preVarNo;
|
||||
int cnt = getCaliValue();
|
||||
int data = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND("DF %p,%d,%d:\n", data_var, cnt, data);
|
||||
|
||||
const arrayVarStruct* array = &sysVarAttribute[varno];
|
||||
if (array->page) {
|
||||
int maxlen = arrayVarBuffer[array->page - 1].size - array->offset - *array->pointvar;
|
||||
if (cnt > maxlen) {
|
||||
WARNING("%03d:%05x: count exceeds array boundary (%d > %d)\n", sl_getPage(), sl_getIndex(), cnt, maxlen);
|
||||
cnt = maxlen;
|
||||
}
|
||||
}
|
||||
|
||||
while (cnt--) {
|
||||
*data_var = data; data_var++;
|
||||
}
|
||||
|
||||
+9
-36
@@ -25,51 +25,24 @@
|
||||
#include <string.h>
|
||||
#include "portab.h"
|
||||
#include "xsystem35.h"
|
||||
|
||||
/* defined by hankana2sjis.c */
|
||||
extern char *num2sjis(int num);
|
||||
#include "hankaku.h"
|
||||
|
||||
void commandH() {
|
||||
int fig = sys_getc();
|
||||
int num = getCaliValue();
|
||||
char _work1[10], _work2[512];
|
||||
char *work1 = _work1, *work2 = _work2;
|
||||
int len;
|
||||
|
||||
*work2 = 0;
|
||||
sprintf(work1, "%d", num);
|
||||
if (fig != 0) {
|
||||
len = strlen(work1);
|
||||
if (fig > len) {
|
||||
/* 空白でうめる */
|
||||
len = fig - len;
|
||||
while(len--) {
|
||||
strcat(work2, num2sjis(10));
|
||||
}
|
||||
} else {
|
||||
work1 += (len - fig);
|
||||
}
|
||||
}
|
||||
while(*work1) {
|
||||
strcat(work2, num2sjis((*work1) - '0')); work1++;
|
||||
}
|
||||
|
||||
sys_addMsg(work2);
|
||||
char buf[512];
|
||||
|
||||
sys_addMsg(format_number_zenkaku(num, fig, buf));
|
||||
|
||||
DEBUG_COMMAND("H %d,%d:\n",fig,num);
|
||||
}
|
||||
|
||||
void commandHH(void) {
|
||||
int fig = sys_getc();
|
||||
int num = getCaliValue();
|
||||
char s[256];
|
||||
if( fig ) {
|
||||
char *ss="%%%dd";
|
||||
char sss[256];
|
||||
sprintf(sss,ss,fig);
|
||||
sprintf(s,sss,num);
|
||||
} else {
|
||||
sprintf(s,"%d",num);
|
||||
}
|
||||
sys_addMsg(s);
|
||||
char buf[256];
|
||||
|
||||
sys_addMsg(format_number(num, fig, buf));
|
||||
|
||||
DEBUG_COMMAND("HH %d,%d:\n",fig,num);
|
||||
}
|
||||
|
||||
+12
-5
@@ -24,6 +24,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
@@ -32,6 +33,7 @@
|
||||
#include "xsystem35.h"
|
||||
#include "dri.h"
|
||||
#include "savedata.h"
|
||||
#include "utfsjis.h"
|
||||
#include "cg.h"
|
||||
|
||||
void commandLD() {
|
||||
@@ -109,21 +111,24 @@ void commandLE() {
|
||||
char *filename = sys_getString(':');
|
||||
int *var, _var = 0;
|
||||
int num;
|
||||
|
||||
|
||||
char *fname_utf8 = sjis2utf(filename);
|
||||
switch(type) {
|
||||
case 0: /* T2 */
|
||||
var = getCaliVariable();
|
||||
num = getCaliValue();
|
||||
sysVar[0] = save_load_var_with_file(filename, var, num);
|
||||
sysVar[0] = save_load_var_with_file(fname_utf8, var, num);
|
||||
break;
|
||||
case 1: /* 456 */
|
||||
_var = getCaliValue();
|
||||
num = getCaliValue();
|
||||
sysVar[0] = save_load_str_with_file(filename, _var, num);
|
||||
sysVar[0] = save_load_str_with_file(fname_utf8, _var, num);
|
||||
break;
|
||||
default:
|
||||
WARNING("Unknown LE command %d\n", type); return;
|
||||
WARNING("Unknown LE command %d\n", type);
|
||||
break;
|
||||
}
|
||||
free(fname_utf8);
|
||||
|
||||
DEBUG_COMMAND("LE %d,%s,%d,%d:\n",type, filename, _var, num);
|
||||
}
|
||||
@@ -241,7 +246,9 @@ void commandLC() {
|
||||
int y = getCaliValue();
|
||||
char *filename = sys_getString(':');
|
||||
|
||||
sysVar[0] = cg_load_with_filename(filename, x, y);
|
||||
char *fname_utf8 = sjis2utf(filename);
|
||||
sysVar[0] = cg_load_with_filename(fname_utf8, x, y);
|
||||
free(fname_utf8);
|
||||
|
||||
DEBUG_COMMAND("LC %d,%d,%s:\n", x, y, filename);
|
||||
}
|
||||
|
||||
+35
-58
@@ -31,11 +31,11 @@
|
||||
#include "menu.h"
|
||||
#include "ags.h"
|
||||
#include "message.h"
|
||||
#include "gametitle.h"
|
||||
#include "hankaku.h"
|
||||
|
||||
/* defined by cmds.c */
|
||||
extern boolean dummy_pcm_su_flag;
|
||||
/* defined by hankan2sjis.c */
|
||||
extern char *num2sjis(int num);
|
||||
/* defined by cmds.c */
|
||||
extern boolean Y3waitCancel;
|
||||
|
||||
@@ -105,8 +105,8 @@ void commandMI() { /* T2 */
|
||||
char *title = sys_getString(':');
|
||||
char *t1, *t2, *t3;
|
||||
|
||||
t1 = sjis2lang(title);
|
||||
t2 = sjis2lang(v_str(dst_no -1));
|
||||
t1 = sjis2utf(title);
|
||||
t2 = sjis2utf(v_str(dst_no -1));
|
||||
|
||||
mi_param.title = t1;
|
||||
mi_param.oldstring = t2;
|
||||
@@ -119,7 +119,7 @@ void commandMI() { /* T2 */
|
||||
return;
|
||||
}
|
||||
|
||||
t3 = lang2sjis(mi_param.newstring);
|
||||
t3 = utf2sjis(mi_param.newstring);
|
||||
|
||||
/* 全角文字以外は不可 */
|
||||
if (!sjis_has_hankaku(t3)) {
|
||||
@@ -135,8 +135,14 @@ void commandMA() {
|
||||
/* num1 の文字列の後ろに num2 をつなげる */
|
||||
int num1 = getCaliValue();
|
||||
int num2 = getCaliValue();
|
||||
|
||||
v_strcat(num1 - 1, v_str(num2 - 1));
|
||||
|
||||
if (num1 == num2) {
|
||||
char *buf = strdup(v_str(num2 - 1));
|
||||
v_strcat(num1 - 1, buf);
|
||||
free(buf);
|
||||
} else {
|
||||
v_strcat(num1 - 1, v_str(num2 - 1));
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("MA %d,%d:\n",num1,num2);
|
||||
}
|
||||
@@ -155,16 +161,18 @@ void commandMT() {
|
||||
/* ウインドウのタイトル文字列を設定する */
|
||||
char *str = sys_getString(':');
|
||||
|
||||
strncpy(nact->game_title_name, str, sizeof(nact->game_title_name) -1);
|
||||
if (nact->game_title_utf8)
|
||||
free(nact->game_title_utf8);
|
||||
nact->game_title_utf8 = sjis2utf(str);
|
||||
ags_setWindowTitle(str);
|
||||
|
||||
/* 闘神都市II 対策 */
|
||||
if (0 == strcmp(str, GT_TOSHIN2)) {
|
||||
if (0 == strcmp(nact->game_title_utf8, GT_TOSHIN2)) {
|
||||
dummy_pcm_su_flag = TRUE;
|
||||
}
|
||||
|
||||
/* Rance4 対策? */
|
||||
if (0 == strcmp(str, GT_RANCE4)) {
|
||||
if (0 == strcmp(nact->game_title_utf8, GT_RANCE4)) {
|
||||
Y3waitCancel = FALSE;
|
||||
}
|
||||
|
||||
@@ -176,7 +184,8 @@ void commandMM() {
|
||||
int num1 = getCaliValue();
|
||||
int num2 = getCaliValue();
|
||||
|
||||
v_strcpy(num1 - 1, v_str(num2 - 1));
|
||||
if (num1 != num2)
|
||||
v_strcpy(num1 - 1, v_str(num2 - 1));
|
||||
|
||||
DEBUG_COMMAND("MM %d,%d:\n",num1, num2);
|
||||
}
|
||||
@@ -186,29 +195,10 @@ void commandMH() {
|
||||
int num1 = getCaliValue();
|
||||
int fig = getCaliValue();
|
||||
int num2 = getCaliValue();
|
||||
char _work1[10],_work2[200];
|
||||
char *work1 = _work1, *work2 = _work2;
|
||||
int len;
|
||||
|
||||
*work2 = 0;
|
||||
sprintf(work1,"%d",num2);
|
||||
if (fig != 0) {
|
||||
len = strlen(work1);
|
||||
if (fig > len) {
|
||||
/* 空白でうめる */
|
||||
len = fig - len;
|
||||
while(len--) {
|
||||
strcat(work2, num2sjis(10));
|
||||
}
|
||||
} else {
|
||||
work1 += (len - fig);
|
||||
}
|
||||
}
|
||||
while(*work1) {
|
||||
strcat(work2, num2sjis((*work1) - '0')); work1++;
|
||||
}
|
||||
v_strcpy(num1 - 1, work2);
|
||||
|
||||
|
||||
char buf[512];
|
||||
v_strcpy(num1 - 1, format_number_zenkaku(num2, fig, buf));
|
||||
|
||||
DEBUG_COMMAND("MH %d,%d,%d:\n",num1,fig,num2);
|
||||
}
|
||||
|
||||
@@ -236,8 +226,7 @@ void commandMD() {
|
||||
int src_str_no = getCaliValue();
|
||||
int len = getCaliValue();
|
||||
|
||||
strncpy(v_str(dst_str_no - 1), v_str(src_str_no - 1), len * 2);
|
||||
*(v_str(dst_str_no - 1) + len*2) = '\0';
|
||||
v_strncpy(dst_str_no - 1, 0, src_str_no - 1, 0, len);
|
||||
|
||||
DEBUG_COMMAND("MD %d,%d,%d:\n",dst_str_no, src_str_no, len);
|
||||
}
|
||||
@@ -250,8 +239,7 @@ void commandME() {
|
||||
int src_pos = getCaliValue();
|
||||
int len = getCaliValue();
|
||||
|
||||
strncpy(v_str(dst_str_no - 1) + dst_pos * 2, v_str(src_str_no - 1) + src_pos * 2, len*2);
|
||||
*(v_str(dst_str_no - 1) + dst_pos * 2 + len*2) = '\0';
|
||||
v_strncpy(dst_str_no - 1, dst_pos, src_str_no - 1, src_pos, len);
|
||||
|
||||
DEBUG_COMMAND("ME %d,%d,%d,%d,%d:\n",dst_str_no, dst_pos, src_str_no, src_pos, len);
|
||||
}
|
||||
@@ -262,14 +250,13 @@ void commandMF() {
|
||||
int dst_no = getCaliValue();
|
||||
int key_no = getCaliValue();
|
||||
int start_pos = getCaliValue();
|
||||
char *start = v_str(dst_no - 1) + start_pos * 2;
|
||||
|
||||
char *pos = strstr(start, v_str(key_no - 1));
|
||||
int pos = v_strstr(dst_no - 1, start_pos, v_str(key_no - 1));
|
||||
|
||||
if (pos == NULL) {
|
||||
if (pos < 0) {
|
||||
sysVar[0] = 255;
|
||||
} else {
|
||||
*var = (pos - start) / 2;
|
||||
*var = pos;
|
||||
sysVar[0] = 0;
|
||||
}
|
||||
|
||||
@@ -326,7 +313,7 @@ void commandMG() {
|
||||
break;
|
||||
case 7:
|
||||
var = getCaliVariable();
|
||||
*var = v_strlen(nact->msg.mg_curStrVarNo -1) / 2;
|
||||
*var = v_strlen(nact->msg.mg_curStrVarNo -1);
|
||||
break;
|
||||
case 100:
|
||||
sw = getCaliValue();
|
||||
@@ -351,7 +338,7 @@ void commandMJ() {
|
||||
INPUTSTRING_PARAM mj_param;
|
||||
char *t1, *t2;
|
||||
|
||||
t1 = sjis2lang(v_str(num -1));
|
||||
t1 = sjis2utf(v_str(num -1));
|
||||
mj_param.max = max_len;
|
||||
mj_param.x = x;
|
||||
mj_param.y = y;
|
||||
@@ -362,7 +349,7 @@ void commandMJ() {
|
||||
menu_inputstring2(&mj_param);
|
||||
if (mj_param.newstring == NULL) return;
|
||||
|
||||
t2 = lang2sjis(mj_param.newstring);
|
||||
t2 = utf2sjis(mj_param.newstring);
|
||||
if (!sjis_has_hankaku(t2)) {
|
||||
v_strcpy(num -1, t2);
|
||||
}
|
||||
@@ -376,26 +363,16 @@ void commandMN() {
|
||||
int num = getCaliValue();
|
||||
int *var = getCaliVariable();
|
||||
int i, len;
|
||||
char *b;
|
||||
const char *b;
|
||||
|
||||
switch(no) {
|
||||
case 0:
|
||||
/* 文字列を配列に変換する */
|
||||
len = v_strlen(num -1);
|
||||
b = v_str(num -1);
|
||||
for (i = 0; i < len; i++) {
|
||||
*var = *b;
|
||||
var++; b++;
|
||||
}
|
||||
*var = 0;
|
||||
sysVar[0] = v_strToVars(num - 1, var);
|
||||
break;
|
||||
case 1:
|
||||
/* 配列を文字列に変換する */
|
||||
b = v_str(num -1);
|
||||
while(*var) {
|
||||
*b = *var; b++; var++;
|
||||
}
|
||||
*b = '\0';
|
||||
v_strFromVars(num - 1, var);
|
||||
break;
|
||||
default:
|
||||
WARNING("UnKnown MN command(%d)\n", no);
|
||||
|
||||
+1
-1
@@ -380,7 +380,7 @@ void commandNT() { /* From Panyo */
|
||||
if (ni_param.title != NULL) {
|
||||
free(ni_param.title);
|
||||
}
|
||||
t = sjis2lang(str);
|
||||
t = sjis2utf(str);
|
||||
ni_param.title = t;
|
||||
|
||||
DEBUG_COMMAND("NT %p:\n", str);
|
||||
|
||||
+8
-4
@@ -23,9 +23,11 @@
|
||||
/* $Id: cmdq.c,v 1.12 2003/01/25 01:34:50 chikama Exp $ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "portab.h"
|
||||
#include "xsystem35.h"
|
||||
#include "savedata.h"
|
||||
#include "utfsjis.h"
|
||||
|
||||
#define WARN_SAVEERR(cmd, st) \
|
||||
if (st > 200) fprintf(stderr, "WARNING: Fail to save (cmd=%s, stat=%d)\n", cmd, st)
|
||||
@@ -85,21 +87,23 @@ void commandQE() {
|
||||
char *filename = sys_getString(':');
|
||||
int *var, _var = 0, cnt;
|
||||
|
||||
char *fname_utf8 = sjis2utf(filename);
|
||||
switch(type) {
|
||||
case 0:
|
||||
var = getCaliVariable();
|
||||
cnt = getCaliValue();
|
||||
sysVar[0] = save_save_var_with_file(filename, var, cnt);
|
||||
sysVar[0] = save_save_var_with_file(fname_utf8, var, cnt);
|
||||
break;
|
||||
case 1:
|
||||
_var = getCaliValue();
|
||||
cnt = getCaliValue();
|
||||
sysVar[0] = save_save_str_with_file(filename, _var, cnt);
|
||||
sysVar[0] = save_save_str_with_file(fname_utf8, _var, cnt);
|
||||
break;
|
||||
default:
|
||||
WARNING("Unknown QE command %d\n", type); return;
|
||||
WARNING("Unknown QE command %d\n", type);
|
||||
break;
|
||||
}
|
||||
|
||||
free(fname_utf8);
|
||||
WARN_SAVEERR("QE", sysVar[0]);
|
||||
|
||||
DEBUG_COMMAND("QE %d,%s,%d,%d:\n", type, filename, _var, cnt);
|
||||
|
||||
@@ -1,611 +0,0 @@
|
||||
int cp932tosjis0213(int code) {
|
||||
int ret;
|
||||
|
||||
switch(code){
|
||||
case 0x8160: ret = 0x81b0; break;
|
||||
case 0x8161: ret = 0x81d2; break;
|
||||
case 0x817c: ret = 0x81af; break;
|
||||
case 0x8790: ret = 0x81e0; break;
|
||||
case 0x8791: ret = 0x81df; break;
|
||||
case 0x8792: ret = 0x81e7; break;
|
||||
case 0x8795: ret = 0x81e3; break;
|
||||
case 0x8796: ret = 0x81db; break;
|
||||
case 0x8797: ret = 0x81da; break;
|
||||
case 0x879a: ret = 0x81e6; break;
|
||||
case 0x879b: ret = 0x81bf; break;
|
||||
case 0x879c: ret = 0x81be; break;
|
||||
case 0xed40: ret = 0xedb5; break;
|
||||
case 0xed41: ret = 0xee8e; break;
|
||||
case 0xed42: ret = 0xef58; break;
|
||||
case 0xed43: ret = 0xef4d; break;
|
||||
case 0xed44: ret = 0xf8d3; break;
|
||||
case 0xed45: ret = 0x87b7; break;
|
||||
case 0xed46: ret = 0xf580; break;
|
||||
case 0xed47: ret = 0xeb54; break;
|
||||
case 0xed48: ret = 0xeb89; break;
|
||||
case 0xed49: ret = 0xfb42; break;
|
||||
case 0xed4a: ret = 0xeb56; break;
|
||||
case 0xed4b: ret = 0xeab8; break;
|
||||
case 0xed4c: ret = 0x87a2; break;
|
||||
case 0xed4d: ret = 0x87a6; break;
|
||||
case 0xed4f: ret = 0xf05e; break;
|
||||
case 0xed50: ret = 0x87a9; break;
|
||||
case 0xed52: ret = 0x87ae; break;
|
||||
case 0xed53: ret = 0xf06c; break;
|
||||
case 0xed54: ret = 0x87b3; break;
|
||||
case 0xed55: ret = 0xf06d; break;
|
||||
case 0xed56: ret = 0x87b4; break;
|
||||
case 0xed58: ret = 0x87bf; break;
|
||||
case 0xed59: ret = 0xf07c; break;
|
||||
case 0xed5b: ret = 0xf07b; break;
|
||||
case 0xed5c: ret = 0xf080; break;
|
||||
case 0xed5d: ret = 0xf087; break;
|
||||
case 0xed5e: ret = 0xf07e; break;
|
||||
case 0xed5f: ret = 0x87c2; break;
|
||||
case 0xed62: ret = 0x87cd; break;
|
||||
case 0xed64: ret = 0x87d2; break;
|
||||
case 0xed67: ret = 0x87db; break;
|
||||
case 0xed69: ret = 0xf162; break;
|
||||
case 0xed6b: ret = 0x87e5; break;
|
||||
case 0xed6c: ret = 0x87e9; break;
|
||||
case 0xed6d: ret = 0x87ea; break;
|
||||
case 0xed6e: ret = 0xf16d; break;
|
||||
case 0xed70: ret = 0x87f0; break;
|
||||
case 0xed71: ret = 0x87f2; break;
|
||||
case 0xed74: ret = 0x87f6; break;
|
||||
case 0xed75: ret = 0xf18c; break;
|
||||
case 0xed76: ret = 0x8840; break;
|
||||
case 0xed77: ret = 0x8842; break;
|
||||
case 0xed78: ret = 0x8849; break;
|
||||
case 0xed7b: ret = 0xf1ea; break;
|
||||
case 0xed7c: ret = 0x886e; break;
|
||||
case 0xed7d: ret = 0x886d; break;
|
||||
case 0xed7e: ret = 0x886a; break;
|
||||
case 0xed80: ret = 0x8876; break;
|
||||
case 0xed81: ret = 0x887c; break;
|
||||
case 0xed83: ret = 0xf259; break;
|
||||
case 0xed85: ret = 0xf264; break;
|
||||
case 0xed86: ret = 0x8889; break;
|
||||
case 0xed88: ret = 0x888d; break;
|
||||
case 0xed8a: ret = 0x9875; break;
|
||||
case 0xed8b: ret = 0xf0a2; break;
|
||||
case 0xed8c: ret = 0xecc7; break;
|
||||
case 0xed8d: ret = 0x9878; break;
|
||||
case 0xed8e: ret = 0x9879; break;
|
||||
case 0xed8f: ret = 0x987b; break;
|
||||
case 0xed90: ret = 0xf0c1; break;
|
||||
case 0xed91: ret = 0x9889; break;
|
||||
case 0xed93: ret = 0x9891; break;
|
||||
case 0xed94: ret = 0x9895; break;
|
||||
case 0xed95: ret = 0x9892; break;
|
||||
case 0xed96: ret = 0xf0d3; break;
|
||||
case 0xed97: ret = 0x9897; break;
|
||||
case 0xed98: ret = 0x989c; break;
|
||||
case 0xed99: ret = 0xf0e5; break;
|
||||
case 0xed9c: ret = 0xeab4; break;
|
||||
case 0xed9d: ret = 0xeabc; break;
|
||||
case 0xed9e: ret = 0xeac3; break;
|
||||
case 0xed9f: ret = 0xeac5; break;
|
||||
case 0xeda2: ret = 0xf2cb; break;
|
||||
case 0xeda4: ret = 0xead3; break;
|
||||
case 0xeda6: ret = 0xf2d6; break;
|
||||
case 0xeda8: ret = 0xead9; break;
|
||||
case 0xeda9: ret = 0xead8; break;
|
||||
case 0xedaa: ret = 0xf2e7; break;
|
||||
case 0xedac: ret = 0xf341; break;
|
||||
case 0xedad: ret = 0xeaf2; break;
|
||||
case 0xedae: ret = 0xeaf8; break;
|
||||
case 0xedaf: ret = 0xf36f; break;
|
||||
case 0xedb0: ret = 0xeafa; break;
|
||||
case 0xedb2: ret = 0xeb4b; break;
|
||||
case 0xedb3: ret = 0xeb4d; break;
|
||||
case 0xedb5: ret = 0xeb4c; break;
|
||||
case 0xedb7: ret = 0xeb4e; break;
|
||||
case 0xedb8: ret = 0xeb51; break;
|
||||
case 0xedb9: ret = 0xeb5d; break;
|
||||
case 0xedba: ret = 0xf39e; break;
|
||||
case 0xedbb: ret = 0xeb5a; break;
|
||||
case 0xedbd: ret = 0xeb5e; break;
|
||||
case 0xedbe: ret = 0xf3ab; break;
|
||||
case 0xedbf: ret = 0xeb63; break;
|
||||
case 0xedc0: ret = 0xeb64; break;
|
||||
case 0xedc1: ret = 0xf3b1; break;
|
||||
case 0xedc2: ret = 0xeb6b; break;
|
||||
case 0xedc4: ret = 0xeb6d; break;
|
||||
case 0xedc5: ret = 0xeb6f; break;
|
||||
case 0xedc6: ret = 0xeb77; break;
|
||||
case 0xedc7: ret = 0xeb7d; break;
|
||||
case 0xedc8: ret = 0xeb79; break;
|
||||
case 0xedc9: ret = 0xeb7c; break;
|
||||
case 0xedca: ret = 0xf3dd; break;
|
||||
case 0xedcb: ret = 0xf3fb; break;
|
||||
case 0xedcc: ret = 0xf3f7; break;
|
||||
case 0xedcd: ret = 0xeb98; break;
|
||||
case 0xedce: ret = 0xeb9a; break;
|
||||
case 0xedcf: ret = 0xf455; break;
|
||||
case 0xedd0: ret = 0xeba0; break;
|
||||
case 0xedd1: ret = 0xf460; break;
|
||||
case 0xedd2: ret = 0xebae; break;
|
||||
case 0xedd3: ret = 0xf472; break;
|
||||
case 0xedd4: ret = 0xebaf; break;
|
||||
case 0xedd5: ret = 0xf479; break;
|
||||
case 0xedd7: ret = 0xebb6; break;
|
||||
case 0xedd8: ret = 0xebc9; break;
|
||||
case 0xedd9: ret = 0xf4b3; break;
|
||||
case 0xedda: ret = 0xebd0; break;
|
||||
case 0xeddb: ret = 0xebd5; break;
|
||||
case 0xeddd: ret = 0xf4c2; break;
|
||||
case 0xedde: ret = 0xebdf; break;
|
||||
case 0xeddf: ret = 0xebe9; break;
|
||||
case 0xede2: ret = 0xebed; break;
|
||||
case 0xede3: ret = 0xf4e6; break;
|
||||
case 0xede6: ret = 0xebf4; break;
|
||||
case 0xede8: ret = 0xebf8; break;
|
||||
case 0xede9: ret = 0xf4ee; break;
|
||||
case 0xedea: ret = 0xf4f1; break;
|
||||
case 0xedeb: ret = 0xf543; break;
|
||||
case 0xedec: ret = 0xec4e; break;
|
||||
case 0xeded: ret = 0xf560; break;
|
||||
case 0xedee: ret = 0xec5a; break;
|
||||
case 0xedef: ret = 0xec5b; break;
|
||||
case 0xedf0: ret = 0xf569; break;
|
||||
case 0xedf1: ret = 0xec5d; break;
|
||||
case 0xedf2: ret = 0xec64; break;
|
||||
case 0xedf3: ret = 0xec66; break;
|
||||
case 0xedf4: ret = 0xec6b; break;
|
||||
case 0xedf5: ret = 0xf58b; break;
|
||||
case 0xedf6: ret = 0xec76; break;
|
||||
case 0xedf7: ret = 0xec71; break;
|
||||
case 0xedf8: ret = 0xec72; break;
|
||||
case 0xedf9: ret = 0xec79; break;
|
||||
case 0xedfa: ret = 0xec7d; break;
|
||||
case 0xedfb: ret = 0xec81; break;
|
||||
case 0xedfc: ret = 0xf5bb; break;
|
||||
case 0xee40: ret = 0xec89; break;
|
||||
case 0xee42: ret = 0xec8f; break;
|
||||
case 0xee43: ret = 0xf5d5; break;
|
||||
case 0xee45: ret = 0xec99; break;
|
||||
case 0xee46: ret = 0xec9b; break;
|
||||
case 0xee47: ret = 0xec9d; break;
|
||||
case 0xee49: ret = 0xec9f; break;
|
||||
case 0xee4b: ret = 0xeca4; break;
|
||||
case 0xee4c: ret = 0xeca6; break;
|
||||
case 0xee4e: ret = 0xeca9; break;
|
||||
case 0xee4f: ret = 0xecb1; break;
|
||||
case 0xee50: ret = 0xecb6; break;
|
||||
case 0xee51: ret = 0xecb9; break;
|
||||
case 0xee52: ret = 0xecc5; break;
|
||||
case 0xee53: ret = 0xecc8; break;
|
||||
case 0xee55: ret = 0xf68f; break;
|
||||
case 0xee56: ret = 0xece1; break;
|
||||
case 0xee57: ret = 0xecdf; break;
|
||||
case 0xee58: ret = 0xece2; break;
|
||||
case 0xee5a: ret = 0xecf0; break;
|
||||
case 0xee5b: ret = 0xf163; break;
|
||||
case 0xee5c: ret = 0xf6c1; break;
|
||||
case 0xee5d: ret = 0xed41; break;
|
||||
case 0xee5e: ret = 0xf6c4; break;
|
||||
case 0xee60: ret = 0xf6dc; break;
|
||||
case 0xee62: ret = 0xed5b; break;
|
||||
case 0xee63: ret = 0xed5c; break;
|
||||
case 0xee64: ret = 0xf6e5; break;
|
||||
case 0xee65: ret = 0xed60; break;
|
||||
case 0xee66: ret = 0xf6e8; break;
|
||||
case 0xee67: ret = 0xf758; break;
|
||||
case 0xee68: ret = 0xf759; break;
|
||||
case 0xee6a: ret = 0xed77; break;
|
||||
case 0xee6b: ret = 0xed83; break;
|
||||
case 0xee6d: ret = 0xeda0; break;
|
||||
case 0xee6e: ret = 0xeda2; break;
|
||||
case 0xee6f: ret = 0xf7c5; break;
|
||||
case 0xee70: ret = 0xeda6; break;
|
||||
case 0xee71: ret = 0xedaa; break;
|
||||
case 0xee72: ret = 0xedb3; break;
|
||||
case 0xee73: ret = 0xedb7; break;
|
||||
case 0xee76: ret = 0xedea; break;
|
||||
case 0xee77: ret = 0xedeb; break;
|
||||
case 0xee78: ret = 0xf8b1; break;
|
||||
case 0xee79: ret = 0xedfb; break;
|
||||
case 0xee7b: ret = 0xee47; break;
|
||||
case 0xee7c: ret = 0xee4e; break;
|
||||
case 0xee7d: ret = 0xf8ef; break;
|
||||
case 0xee7e: ret = 0xee57; break;
|
||||
case 0xee81: ret = 0xee59; break;
|
||||
case 0xee82: ret = 0xee5f; break;
|
||||
case 0xee83: ret = 0xf957; break;
|
||||
case 0xee84: ret = 0xf964; break;
|
||||
case 0xee86: ret = 0xee8d; break;
|
||||
case 0xee87: ret = 0xee9d; break;
|
||||
case 0xee88: ret = 0xeea0; break;
|
||||
case 0xee89: ret = 0xeea6; break;
|
||||
case 0xee8a: ret = 0xeea7; break;
|
||||
case 0xee8b: ret = 0xf9de; break;
|
||||
case 0xee8c: ret = 0xeea9; break;
|
||||
case 0xee8d: ret = 0xeeac; break;
|
||||
case 0xee8e: ret = 0xeeab; break;
|
||||
case 0xee90: ret = 0xf9ed; break;
|
||||
case 0xee91: ret = 0xfa4f; break;
|
||||
case 0xee92: ret = 0xeeb8; break;
|
||||
case 0xee93: ret = 0xeebc; break;
|
||||
case 0xee97: ret = 0xfa8e; break;
|
||||
case 0xee9a: ret = 0xeee5; break;
|
||||
case 0xee9b: ret = 0xeee8; break;
|
||||
case 0xee9c: ret = 0xeeea; break;
|
||||
case 0xee9d: ret = 0xeeee; break;
|
||||
case 0xee9e: ret = 0xfacc; break;
|
||||
case 0xee9f: ret = 0xeefa; break;
|
||||
case 0xeea1: ret = 0xef41; break;
|
||||
case 0xeea2: ret = 0xfad0; break;
|
||||
case 0xeea3: ret = 0xeefc; break;
|
||||
case 0xeea4: ret = 0xef40; break;
|
||||
case 0xeea6: ret = 0xef44; break;
|
||||
case 0xeea7: ret = 0xfad2; break;
|
||||
case 0xeea8: ret = 0xef47; break;
|
||||
case 0xeea9: ret = 0xef49; break;
|
||||
case 0xeeaa: ret = 0xef48; break;
|
||||
case 0xeeab: ret = 0xfada; break;
|
||||
case 0xeeac: ret = 0xfadd; break;
|
||||
case 0xeead: ret = 0xfadb; break;
|
||||
case 0xeeae: ret = 0xef46; break;
|
||||
case 0xeeaf: ret = 0xfae1; break;
|
||||
case 0xeeb0: ret = 0xfaed; break;
|
||||
case 0xeeb2: ret = 0xef4c; break;
|
||||
case 0xeeb3: ret = 0xfafa; break;
|
||||
case 0xeeb4: ret = 0xfaf7; break;
|
||||
case 0xeeb5: ret = 0xfaf8; break;
|
||||
case 0xeeb6: ret = 0xfaf6; break;
|
||||
case 0xeeb9: ret = 0xef52; break;
|
||||
case 0xeeba: ret = 0xef51; break;
|
||||
case 0xeebb: ret = 0xef57; break;
|
||||
case 0xeebc: ret = 0xef56; break;
|
||||
case 0xeebd: ret = 0xfb43; break;
|
||||
case 0xeebf: ret = 0xfb48; break;
|
||||
case 0xeec0: ret = 0xef53; break;
|
||||
case 0xeec1: ret = 0xfb47; break;
|
||||
case 0xeec2: ret = 0xfb44; break;
|
||||
case 0xeec3: ret = 0xef5e; break;
|
||||
case 0xeec4: ret = 0xfb4f; break;
|
||||
case 0xeec6: ret = 0xef62; break;
|
||||
case 0xeec7: ret = 0xef63; break;
|
||||
case 0xeeca: ret = 0xfb6c; break;
|
||||
case 0xeecd: ret = 0xef7c; break;
|
||||
case 0xeecf: ret = 0xef7d; break;
|
||||
case 0xeed0: ret = 0xfb8c; break;
|
||||
case 0xeed1: ret = 0xef86; break;
|
||||
case 0xeed2: ret = 0xef87; break;
|
||||
case 0xeed4: ret = 0xef88; break;
|
||||
case 0xeed5: ret = 0xef8a; break;
|
||||
case 0xeed7: ret = 0xfb9c; break;
|
||||
case 0xeed8: ret = 0xef9f; break;
|
||||
case 0xeed9: ret = 0xefa3; break;
|
||||
case 0xeede: ret = 0xefa9; break;
|
||||
case 0xeedf: ret = 0xefb1; break;
|
||||
case 0xeee1: ret = 0xfc51; break;
|
||||
case 0xeee2: ret = 0xefc2; break;
|
||||
case 0xeee3: ret = 0xefc1; break;
|
||||
case 0xeee4: ret = 0xefc5; break;
|
||||
case 0xeee5: ret = 0xfc69; break;
|
||||
case 0xeee7: ret = 0xefcd; break;
|
||||
case 0xeee8: ret = 0xefdc; break;
|
||||
case 0xeee9: ret = 0xfcb2; break;
|
||||
case 0xeeeb: ret = 0xfccd; break;
|
||||
case 0xeeec: ret = 0xeff0; break;
|
||||
case 0xeeef: ret = 0x86b3; break;
|
||||
case 0xeef0: ret = 0x86b4; break;
|
||||
case 0xeef1: ret = 0x86b5; break;
|
||||
case 0xeef2: ret = 0x86b6; break;
|
||||
case 0xeef3: ret = 0x86b7; break;
|
||||
case 0xeef4: ret = 0x86b8; break;
|
||||
case 0xeef5: ret = 0x86b9; break;
|
||||
case 0xeef6: ret = 0x86ba; break;
|
||||
case 0xeef7: ret = 0x86bb; break;
|
||||
case 0xeef8: ret = 0x86bc; break;
|
||||
case 0xeefb: ret = 0x81ad; break;
|
||||
case 0xeefc: ret = 0x81ae; break;
|
||||
case 0xfa40: ret = 0x86b3; break;
|
||||
case 0xfa41: ret = 0x86b4; break;
|
||||
case 0xfa42: ret = 0x86b5; break;
|
||||
case 0xfa43: ret = 0x86b6; break;
|
||||
case 0xfa44: ret = 0x86b7; break;
|
||||
case 0xfa45: ret = 0x86b8; break;
|
||||
case 0xfa46: ret = 0x86b9; break;
|
||||
case 0xfa47: ret = 0x86ba; break;
|
||||
case 0xfa48: ret = 0x86bb; break;
|
||||
case 0xfa49: ret = 0x86bc; break;
|
||||
case 0xfa4a: ret = 0x8754; break;
|
||||
case 0xfa4b: ret = 0x8755; break;
|
||||
case 0xfa4c: ret = 0x8756; break;
|
||||
case 0xfa4d: ret = 0x8757; break;
|
||||
case 0xfa4e: ret = 0x8758; break;
|
||||
case 0xfa4f: ret = 0x8759; break;
|
||||
case 0xfa50: ret = 0x875a; break;
|
||||
case 0xfa51: ret = 0x875b; break;
|
||||
case 0xfa52: ret = 0x875c; break;
|
||||
case 0xfa53: ret = 0x875d; break;
|
||||
case 0xfa56: ret = 0x81ad; break;
|
||||
case 0xfa57: ret = 0x81ae; break;
|
||||
case 0xfa58: ret = 0x878a; break;
|
||||
case 0xfa59: ret = 0x8782; break;
|
||||
case 0xfa5a: ret = 0x8784; break;
|
||||
case 0xfa5b: ret = 0x81e6; break;
|
||||
case 0xfa5c: ret = 0xedb5; break;
|
||||
case 0xfa5d: ret = 0xee8e; break;
|
||||
case 0xfa5e: ret = 0xef58; break;
|
||||
case 0xfa5f: ret = 0xef4d; break;
|
||||
case 0xfa60: ret = 0xf8d3; break;
|
||||
case 0xfa61: ret = 0x87b7; break;
|
||||
case 0xfa62: ret = 0xf580; break;
|
||||
case 0xfa63: ret = 0xeb54; break;
|
||||
case 0xfa64: ret = 0xeb89; break;
|
||||
case 0xfa65: ret = 0xfb42; break;
|
||||
case 0xfa66: ret = 0xeb56; break;
|
||||
case 0xfa67: ret = 0xeab8; break;
|
||||
case 0xfa68: ret = 0x87a2; break;
|
||||
case 0xfa69: ret = 0x87a6; break;
|
||||
case 0xfa6b: ret = 0xf05e; break;
|
||||
case 0xfa6c: ret = 0x87a9; break;
|
||||
case 0xfa6e: ret = 0x87ae; break;
|
||||
case 0xfa6f: ret = 0xf06c; break;
|
||||
case 0xfa70: ret = 0x87b3; break;
|
||||
case 0xfa71: ret = 0xf06d; break;
|
||||
case 0xfa72: ret = 0x87b4; break;
|
||||
case 0xfa74: ret = 0x87bf; break;
|
||||
case 0xfa75: ret = 0xf07c; break;
|
||||
case 0xfa77: ret = 0xf07b; break;
|
||||
case 0xfa78: ret = 0xf080; break;
|
||||
case 0xfa79: ret = 0xf087; break;
|
||||
case 0xfa7a: ret = 0xf07e; break;
|
||||
case 0xfa7b: ret = 0x87c2; break;
|
||||
case 0xfa7e: ret = 0x87cd; break;
|
||||
case 0xfa81: ret = 0x87d2; break;
|
||||
case 0xfa84: ret = 0x87db; break;
|
||||
case 0xfa86: ret = 0xf162; break;
|
||||
case 0xfa88: ret = 0x87e5; break;
|
||||
case 0xfa89: ret = 0x87e9; break;
|
||||
case 0xfa8a: ret = 0x87ea; break;
|
||||
case 0xfa8b: ret = 0xf16d; break;
|
||||
case 0xfa8d: ret = 0x87f0; break;
|
||||
case 0xfa8e: ret = 0x87f2; break;
|
||||
case 0xfa91: ret = 0x87f6; break;
|
||||
case 0xfa92: ret = 0xf18c; break;
|
||||
case 0xfa93: ret = 0x8840; break;
|
||||
case 0xfa94: ret = 0x8842; break;
|
||||
case 0xfa95: ret = 0x8849; break;
|
||||
case 0xfa98: ret = 0xf1ea; break;
|
||||
case 0xfa99: ret = 0x886e; break;
|
||||
case 0xfa9a: ret = 0x886d; break;
|
||||
case 0xfa9b: ret = 0x886a; break;
|
||||
case 0xfa9c: ret = 0x8876; break;
|
||||
case 0xfa9d: ret = 0x887c; break;
|
||||
case 0xfa9f: ret = 0xf259; break;
|
||||
case 0xfaa1: ret = 0xf264; break;
|
||||
case 0xfaa2: ret = 0x8889; break;
|
||||
case 0xfaa4: ret = 0x888d; break;
|
||||
case 0xfaa6: ret = 0x9875; break;
|
||||
case 0xfaa7: ret = 0xf0a2; break;
|
||||
case 0xfaa8: ret = 0xecc7; break;
|
||||
case 0xfaa9: ret = 0x9878; break;
|
||||
case 0xfaaa: ret = 0x9879; break;
|
||||
case 0xfaab: ret = 0x987b; break;
|
||||
case 0xfaac: ret = 0xf0c1; break;
|
||||
case 0xfaad: ret = 0x9889; break;
|
||||
case 0xfaaf: ret = 0x9891; break;
|
||||
case 0xfab0: ret = 0x9895; break;
|
||||
case 0xfab1: ret = 0x9892; break;
|
||||
case 0xfab2: ret = 0xf0d3; break;
|
||||
case 0xfab3: ret = 0x9897; break;
|
||||
case 0xfab4: ret = 0x989c; break;
|
||||
case 0xfab5: ret = 0xf0e5; break;
|
||||
case 0xfab8: ret = 0xeab4; break;
|
||||
case 0xfab9: ret = 0xeabc; break;
|
||||
case 0xfaba: ret = 0xeac3; break;
|
||||
case 0xfabb: ret = 0xeac5; break;
|
||||
case 0xfabe: ret = 0xf2cb; break;
|
||||
case 0xfac0: ret = 0xead3; break;
|
||||
case 0xfac2: ret = 0xf2d6; break;
|
||||
case 0xfac4: ret = 0xead9; break;
|
||||
case 0xfac5: ret = 0xead8; break;
|
||||
case 0xfac6: ret = 0xf2e7; break;
|
||||
case 0xfac8: ret = 0xf341; break;
|
||||
case 0xfac9: ret = 0xeaf2; break;
|
||||
case 0xfaca: ret = 0xeaf8; break;
|
||||
case 0xfacb: ret = 0xf36f; break;
|
||||
case 0xfacc: ret = 0xeafa; break;
|
||||
case 0xface: ret = 0xeb4b; break;
|
||||
case 0xfacf: ret = 0xeb4d; break;
|
||||
case 0xfad1: ret = 0xeb4c; break;
|
||||
case 0xfad3: ret = 0xeb4e; break;
|
||||
case 0xfad4: ret = 0xeb51; break;
|
||||
case 0xfad5: ret = 0xeb5d; break;
|
||||
case 0xfad6: ret = 0xf39e; break;
|
||||
case 0xfad7: ret = 0xeb5a; break;
|
||||
case 0xfad9: ret = 0xeb5e; break;
|
||||
case 0xfada: ret = 0xf3ab; break;
|
||||
case 0xfadb: ret = 0xeb63; break;
|
||||
case 0xfadc: ret = 0xeb64; break;
|
||||
case 0xfadd: ret = 0xf3b1; break;
|
||||
case 0xfade: ret = 0xeb6b; break;
|
||||
case 0xfae0: ret = 0xeb6d; break;
|
||||
case 0xfae1: ret = 0xeb6f; break;
|
||||
case 0xfae2: ret = 0xeb77; break;
|
||||
case 0xfae3: ret = 0xeb7d; break;
|
||||
case 0xfae4: ret = 0xeb79; break;
|
||||
case 0xfae5: ret = 0xeb7c; break;
|
||||
case 0xfae6: ret = 0xf3dd; break;
|
||||
case 0xfae7: ret = 0xf3fb; break;
|
||||
case 0xfae8: ret = 0xf3f7; break;
|
||||
case 0xfae9: ret = 0xeb98; break;
|
||||
case 0xfaea: ret = 0xeb9a; break;
|
||||
case 0xfaeb: ret = 0xf455; break;
|
||||
case 0xfaec: ret = 0xeba0; break;
|
||||
case 0xfaed: ret = 0xf460; break;
|
||||
case 0xfaee: ret = 0xebae; break;
|
||||
case 0xfaef: ret = 0xf472; break;
|
||||
case 0xfaf0: ret = 0xebaf; break;
|
||||
case 0xfaf1: ret = 0xf479; break;
|
||||
case 0xfaf3: ret = 0xebb6; break;
|
||||
case 0xfaf4: ret = 0xebc9; break;
|
||||
case 0xfaf5: ret = 0xf4b3; break;
|
||||
case 0xfaf6: ret = 0xebd0; break;
|
||||
case 0xfaf7: ret = 0xebd5; break;
|
||||
case 0xfaf9: ret = 0xf4c2; break;
|
||||
case 0xfafa: ret = 0xebdf; break;
|
||||
case 0xfafb: ret = 0xebe9; break;
|
||||
case 0xfb41: ret = 0xebed; break;
|
||||
case 0xfb42: ret = 0xf4e6; break;
|
||||
case 0xfb45: ret = 0xebf4; break;
|
||||
case 0xfb47: ret = 0xebf8; break;
|
||||
case 0xfb48: ret = 0xf4ee; break;
|
||||
case 0xfb49: ret = 0xf4f1; break;
|
||||
case 0xfb4a: ret = 0xf543; break;
|
||||
case 0xfb4b: ret = 0xec4e; break;
|
||||
case 0xfb4c: ret = 0xf560; break;
|
||||
case 0xfb4d: ret = 0xec5a; break;
|
||||
case 0xfb4e: ret = 0xec5b; break;
|
||||
case 0xfb4f: ret = 0xf569; break;
|
||||
case 0xfb50: ret = 0xec5d; break;
|
||||
case 0xfb51: ret = 0xec64; break;
|
||||
case 0xfb52: ret = 0xec66; break;
|
||||
case 0xfb53: ret = 0xec6b; break;
|
||||
case 0xfb54: ret = 0xf58b; break;
|
||||
case 0xfb55: ret = 0xec76; break;
|
||||
case 0xfb56: ret = 0xec71; break;
|
||||
case 0xfb57: ret = 0xec72; break;
|
||||
case 0xfb58: ret = 0xec79; break;
|
||||
case 0xfb59: ret = 0xec7d; break;
|
||||
case 0xfb5a: ret = 0xec81; break;
|
||||
case 0xfb5b: ret = 0xf5bb; break;
|
||||
case 0xfb5c: ret = 0xec89; break;
|
||||
case 0xfb5e: ret = 0xec8f; break;
|
||||
case 0xfb5f: ret = 0xf5d5; break;
|
||||
case 0xfb61: ret = 0xec99; break;
|
||||
case 0xfb62: ret = 0xec9b; break;
|
||||
case 0xfb63: ret = 0xec9d; break;
|
||||
case 0xfb65: ret = 0xec9f; break;
|
||||
case 0xfb67: ret = 0xeca4; break;
|
||||
case 0xfb68: ret = 0xeca6; break;
|
||||
case 0xfb6a: ret = 0xeca9; break;
|
||||
case 0xfb6b: ret = 0xecb1; break;
|
||||
case 0xfb6c: ret = 0xecb6; break;
|
||||
case 0xfb6d: ret = 0xecb9; break;
|
||||
case 0xfb6e: ret = 0xecc5; break;
|
||||
case 0xfb6f: ret = 0xecc8; break;
|
||||
case 0xfb71: ret = 0xf68f; break;
|
||||
case 0xfb72: ret = 0xece1; break;
|
||||
case 0xfb73: ret = 0xecdf; break;
|
||||
case 0xfb74: ret = 0xece2; break;
|
||||
case 0xfb76: ret = 0xecf0; break;
|
||||
case 0xfb77: ret = 0xf163; break;
|
||||
case 0xfb78: ret = 0xf6c1; break;
|
||||
case 0xfb79: ret = 0xed41; break;
|
||||
case 0xfb7a: ret = 0xf6c4; break;
|
||||
case 0xfb7c: ret = 0xf6dc; break;
|
||||
case 0xfb7e: ret = 0xed5b; break;
|
||||
case 0xfb80: ret = 0xed5c; break;
|
||||
case 0xfb81: ret = 0xf6e5; break;
|
||||
case 0xfb82: ret = 0xed60; break;
|
||||
case 0xfb83: ret = 0xf6e8; break;
|
||||
case 0xfb84: ret = 0xf758; break;
|
||||
case 0xfb85: ret = 0xf759; break;
|
||||
case 0xfb87: ret = 0xed77; break;
|
||||
case 0xfb88: ret = 0xed83; break;
|
||||
case 0xfb8a: ret = 0xeda0; break;
|
||||
case 0xfb8b: ret = 0xeda2; break;
|
||||
case 0xfb8c: ret = 0xf7c5; break;
|
||||
case 0xfb8d: ret = 0xeda6; break;
|
||||
case 0xfb8e: ret = 0xedaa; break;
|
||||
case 0xfb8f: ret = 0xedb3; break;
|
||||
case 0xfb90: ret = 0xedb7; break;
|
||||
case 0xfb93: ret = 0xedea; break;
|
||||
case 0xfb94: ret = 0xedeb; break;
|
||||
case 0xfb95: ret = 0xf8b1; break;
|
||||
case 0xfb96: ret = 0xedfb; break;
|
||||
case 0xfb98: ret = 0xee47; break;
|
||||
case 0xfb99: ret = 0xee4e; break;
|
||||
case 0xfb9a: ret = 0xf8ef; break;
|
||||
case 0xfb9b: ret = 0xee57; break;
|
||||
case 0xfb9d: ret = 0xee59; break;
|
||||
case 0xfb9e: ret = 0xee5f; break;
|
||||
case 0xfb9f: ret = 0xf957; break;
|
||||
case 0xfba0: ret = 0xf964; break;
|
||||
case 0xfba2: ret = 0xee8d; break;
|
||||
case 0xfba3: ret = 0xee9d; break;
|
||||
case 0xfba4: ret = 0xeea0; break;
|
||||
case 0xfba5: ret = 0xeea6; break;
|
||||
case 0xfba6: ret = 0xeea7; break;
|
||||
case 0xfba7: ret = 0xf9de; break;
|
||||
case 0xfba8: ret = 0xeea9; break;
|
||||
case 0xfba9: ret = 0xeeac; break;
|
||||
case 0xfbaa: ret = 0xeeab; break;
|
||||
case 0xfbac: ret = 0xf9ed; break;
|
||||
case 0xfbad: ret = 0xfa4f; break;
|
||||
case 0xfbae: ret = 0xeeb8; break;
|
||||
case 0xfbaf: ret = 0xeebc; break;
|
||||
case 0xfbb3: ret = 0xfa8e; break;
|
||||
case 0xfbb6: ret = 0xeee5; break;
|
||||
case 0xfbb7: ret = 0xeee8; break;
|
||||
case 0xfbb8: ret = 0xeeea; break;
|
||||
case 0xfbb9: ret = 0xeeee; break;
|
||||
case 0xfbba: ret = 0xfacc; break;
|
||||
case 0xfbbb: ret = 0xeefa; break;
|
||||
case 0xfbbd: ret = 0xef41; break;
|
||||
case 0xfbbe: ret = 0xfad0; break;
|
||||
case 0xfbbf: ret = 0xeefc; break;
|
||||
case 0xfbc0: ret = 0xef40; break;
|
||||
case 0xfbc2: ret = 0xef44; break;
|
||||
case 0xfbc3: ret = 0xfad2; break;
|
||||
case 0xfbc4: ret = 0xef47; break;
|
||||
case 0xfbc5: ret = 0xef49; break;
|
||||
case 0xfbc6: ret = 0xef48; break;
|
||||
case 0xfbc7: ret = 0xfada; break;
|
||||
case 0xfbc8: ret = 0xfadd; break;
|
||||
case 0xfbc9: ret = 0xfadb; break;
|
||||
case 0xfbca: ret = 0xef46; break;
|
||||
case 0xfbcb: ret = 0xfae1; break;
|
||||
case 0xfbcc: ret = 0xfaed; break;
|
||||
case 0xfbce: ret = 0xef4c; break;
|
||||
case 0xfbcf: ret = 0xfafa; break;
|
||||
case 0xfbd0: ret = 0xfaf7; break;
|
||||
case 0xfbd1: ret = 0xfaf8; break;
|
||||
case 0xfbd2: ret = 0xfaf6; break;
|
||||
case 0xfbd5: ret = 0xef52; break;
|
||||
case 0xfbd6: ret = 0xef51; break;
|
||||
case 0xfbd7: ret = 0xef57; break;
|
||||
case 0xfbd8: ret = 0xef56; break;
|
||||
case 0xfbd9: ret = 0xfb43; break;
|
||||
case 0xfbdb: ret = 0xfb48; break;
|
||||
case 0xfbdc: ret = 0xef53; break;
|
||||
case 0xfbdd: ret = 0xfb47; break;
|
||||
case 0xfbde: ret = 0xfb44; break;
|
||||
case 0xfbdf: ret = 0xef5e; break;
|
||||
case 0xfbe0: ret = 0xfb4f; break;
|
||||
case 0xfbe2: ret = 0xef62; break;
|
||||
case 0xfbe3: ret = 0xef63; break;
|
||||
case 0xfbe6: ret = 0xfb6c; break;
|
||||
case 0xfbe9: ret = 0xef7c; break;
|
||||
case 0xfbeb: ret = 0xef7d; break;
|
||||
case 0xfbec: ret = 0xfb8c; break;
|
||||
case 0xfbed: ret = 0xef86; break;
|
||||
case 0xfbee: ret = 0xef87; break;
|
||||
case 0xfbf0: ret = 0xef88; break;
|
||||
case 0xfbf1: ret = 0xef8a; break;
|
||||
case 0xfbf3: ret = 0xfb9c; break;
|
||||
case 0xfbf4: ret = 0xef9f; break;
|
||||
case 0xfbf5: ret = 0xefa3; break;
|
||||
case 0xfbfa: ret = 0xefa9; break;
|
||||
case 0xfbfb: ret = 0xefb1; break;
|
||||
case 0xfc40: ret = 0xfc51; break;
|
||||
case 0xfc41: ret = 0xefc2; break;
|
||||
case 0xfc42: ret = 0xefc1; break;
|
||||
case 0xfc43: ret = 0xefc5; break;
|
||||
case 0xfc44: ret = 0xfc69; break;
|
||||
case 0xfc46: ret = 0xefcd; break;
|
||||
case 0xfc47: ret = 0xefdc; break;
|
||||
case 0xfc48: ret = 0xfcb2; break;
|
||||
case 0xfc4a: ret = 0xfccd; break;
|
||||
case 0xfc4b: ret = 0xeff0; break;
|
||||
default: ret = code; break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -25,17 +25,10 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "LittleEndian.h"
|
||||
#include "dri.h"
|
||||
#ifdef HAVE_MMAP
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* static maethods
|
||||
@@ -172,26 +165,28 @@ static void get_fileptr(drifiles *d, FILE *fp, int disk) {
|
||||
* Initilize drifile object and check file
|
||||
* file : file name array
|
||||
* cnt : number in file name array
|
||||
* mmapping: mmap file or not
|
||||
* return: drifile object
|
||||
*/
|
||||
drifiles *dri_init(char **file, int cnt, boolean mmapping) {
|
||||
drifiles *dri_init(const char **file, int cnt) {
|
||||
drifiles *d = calloc(1, sizeof(drifiles));
|
||||
FILE *fp;
|
||||
int i;
|
||||
boolean gotmap = FALSE;
|
||||
long filesize;
|
||||
char **filetop = file;
|
||||
|
||||
#ifdef HAVE_MEMORY_MAPPED_FILE
|
||||
boolean mmapping = TRUE;
|
||||
#else
|
||||
boolean mmapping = FALSE;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
if (*(file + i) == NULL) continue;
|
||||
if (file[i] == NULL) continue;
|
||||
/* open check */
|
||||
if (NULL == (fp = fopen(*(file + i), "rb"))) {
|
||||
SYSERROR("File %s is not found\n", *(file + i));
|
||||
if (NULL == (fp = fopen(file[i], "rb"))) {
|
||||
SYSERROR("File %s is not found\n", file[i]);
|
||||
}
|
||||
/* check is drifile or noe */
|
||||
if (!filecheck(fp)) {
|
||||
SYSERROR("File %s is not dri file\n", *(file + i));
|
||||
SYSERROR("File %s is not dri file\n", file[i]);
|
||||
}
|
||||
/* get file map */
|
||||
if (!gotmap) {
|
||||
@@ -200,29 +195,22 @@ drifiles *dri_init(char **file, int cnt, boolean mmapping) {
|
||||
}
|
||||
/* get pointer */
|
||||
get_fileptr(d, fp, i);
|
||||
/* get file size for mmap */
|
||||
filesize = getfilesize(fp);
|
||||
/* copy filenme */
|
||||
d->fnames[i] = strdup(*(file + i));
|
||||
d->fnames[i] = strdup(file[i]);
|
||||
/* close */
|
||||
fclose(fp);
|
||||
#ifdef HAVE_MMAP
|
||||
|
||||
/* mmap */
|
||||
if (mmapping) {
|
||||
int fd;
|
||||
if (0 > (fd = open(*(file + i), O_RDONLY))) {
|
||||
SYSERROR("open: %s\n", strerror(errno));
|
||||
}
|
||||
if (MAP_FAILED == (d->mmapadr[i] = mmap(0, filesize, PROT_READ, MAP_SHARED, fd, 0))) {
|
||||
WARNING("mmap: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
mmap_t *m = map_file(file[i]);
|
||||
if (!m) {
|
||||
mmapping = d->mmapped = FALSE;
|
||||
i = 0; file = filetop; /* retry */
|
||||
continue;
|
||||
i = 0; /* retry */
|
||||
} else {
|
||||
d->mmap[i] = m;
|
||||
d->mmapped = TRUE;
|
||||
}
|
||||
d->mmapped = TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return d;
|
||||
}
|
||||
@@ -256,7 +244,7 @@ dridata *dri_getdata(drifiles *d, int no) {
|
||||
|
||||
/* get data top */
|
||||
if (d->mmapped) {
|
||||
data = d->mmapadr[disk] + dataptr;
|
||||
data = d->mmap[disk]->addr + dataptr;
|
||||
} else {
|
||||
int readsize = dataptr2 - dataptr;
|
||||
FILE *fp;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#define __DRI__
|
||||
|
||||
#include "portab.h"
|
||||
#include "mmap.h"
|
||||
|
||||
#define DRIFILEMAX 255 /* maximum file number for one data type */
|
||||
#define DRIDATAMAX 65535 /* maximum file number in one file */
|
||||
@@ -32,7 +33,7 @@
|
||||
struct _drifiles {
|
||||
/* for mmap */
|
||||
boolean mmapped;
|
||||
void *mmapadr[DRIFILEMAX];
|
||||
mmap_t *mmap[DRIFILEMAX];
|
||||
/* for file access */
|
||||
char *fnames[DRIFILEMAX];
|
||||
/* max file number in files */
|
||||
@@ -55,7 +56,7 @@ struct _dridata {
|
||||
};
|
||||
typedef struct _dridata dridata;
|
||||
|
||||
extern drifiles *dri_init(char **file, int cnt, boolean mmapping);
|
||||
extern drifiles *dri_init(const char **file, int cnt);
|
||||
extern dridata *dri_getdata(drifiles *d, int no);
|
||||
|
||||
#endif /* !__DRI__ */
|
||||
|
||||
+38
-38
@@ -26,19 +26,17 @@
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#include "filecheck.h"
|
||||
#include "utfsjis.h"
|
||||
|
||||
struct fnametable {
|
||||
char *realname;
|
||||
char *transname;
|
||||
};
|
||||
|
||||
static char *saveDataPath;
|
||||
static boolean newfile_kanjicode_utf8 = TRUE;
|
||||
|
||||
static char *get_fullpath(const char* dir, char *filename) {
|
||||
static char *get_fullpath(const char* dir, const char *filename) {
|
||||
char *fn = malloc(strlen(filename) + strlen(dir) + 3);
|
||||
if (fn == NULL) {
|
||||
return NULL;
|
||||
@@ -51,47 +49,57 @@ static char *get_fullpath(const char* dir, char *filename) {
|
||||
|
||||
/* list up file in current directory */
|
||||
/* name : save/load directory */
|
||||
void fc_init(char *name) {
|
||||
void fc_init(const char *name) {
|
||||
saveDataPath = strdup(name);
|
||||
}
|
||||
|
||||
static char *fc_search(const char *fname_sjis, const char *dir) {
|
||||
#ifdef _WIN32
|
||||
|
||||
FILE *fopen_utf8(const char *path_utf8, char type) {
|
||||
wchar_t wpath[PATH_MAX + 1];
|
||||
if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, path_utf8, -1, wpath, PATH_MAX + 1))
|
||||
return NULL;
|
||||
return _wfopen(wpath, type == 'r' ? L"rb" : L"wb");
|
||||
}
|
||||
|
||||
FILE *fc_open(const char *fname_utf8, char type) {
|
||||
char *path = get_fullpath(saveDataPath, fname_utf8);
|
||||
FILE *fp = fopen_utf8(path, type);
|
||||
if (!fp && type == 'r') {
|
||||
fp = fopen_utf8(fname_utf8, type);
|
||||
}
|
||||
free(path);
|
||||
return fp;
|
||||
}
|
||||
|
||||
#else // !_WIN32
|
||||
|
||||
static char *fc_search(const char *fname_utf8, const char *dir) {
|
||||
DIR *d = opendir(dir);
|
||||
if (d == NULL)
|
||||
return NULL;
|
||||
|
||||
BYTE *fname_utf = sjis2lang(fname_sjis);
|
||||
char *found = NULL;
|
||||
struct dirent *entry;
|
||||
while ((entry = readdir(d)) != NULL) {
|
||||
if (strcasecmp(fname_sjis, entry->d_name) == 0 ||
|
||||
strcasecmp(fname_utf, entry->d_name) == 0) {
|
||||
if (strcasecmp(fname_utf8, entry->d_name) == 0) {
|
||||
found = get_fullpath(dir, entry->d_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
free(fname_utf);
|
||||
return found;
|
||||
}
|
||||
|
||||
FILE *fc_open(char *filename, char type) {
|
||||
char *fullpath = fc_search(filename, saveDataPath);
|
||||
if (fullpath == NULL) {
|
||||
FILE *fc_open(const char *fname_utf8, char type) {
|
||||
char *fullpath = fc_search(fname_utf8, saveDataPath);
|
||||
if (!fullpath) {
|
||||
if (type == 'r') {
|
||||
#ifdef __EMSCRIPTEN__
|
||||
fullpath = fc_search(filename, ".");
|
||||
#endif
|
||||
if (fullpath == NULL)
|
||||
fullpath = fc_search(fname_utf8, ".");
|
||||
if (!fullpath)
|
||||
return NULL;
|
||||
} else {
|
||||
if (newfile_kanjicode_utf8) {
|
||||
char *fc = sjis2lang(filename);
|
||||
fullpath = get_fullpath(saveDataPath, fc);
|
||||
free(fc);
|
||||
}
|
||||
else
|
||||
fullpath = get_fullpath(saveDataPath, filename);
|
||||
fullpath = get_fullpath(saveDataPath, fname_utf8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,8 +113,9 @@ FILE *fc_open(char *filename, char type) {
|
||||
free(fullpath);
|
||||
return fp;
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
void fc_backup_oldfile(char *filename) {
|
||||
void fc_backup_oldfile(const char *filename) {
|
||||
#ifndef __EMSCRIPTEN__
|
||||
char *newname;
|
||||
|
||||
@@ -120,12 +129,3 @@ void fc_backup_oldfile(char *filename) {
|
||||
free(newname);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* QE で新規ファイルをセーブする時のファイル名の漢字コード */
|
||||
void fc_set_default_kanjicode(int c) {
|
||||
if (c == 0) {
|
||||
newfile_kanjicode_utf8 = TRUE;
|
||||
} else {
|
||||
newfile_kanjicode_utf8 = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-7
@@ -24,12 +24,8 @@
|
||||
#ifndef __FILECHECK_H__
|
||||
#define __FILECHECK_H__
|
||||
|
||||
#define FILENAME_KANJI_CODE_UTF8 0
|
||||
#define FILENAME_KANJI_CODE_SJIS 1
|
||||
|
||||
extern void fc_init(char *name);
|
||||
extern FILE *fc_open(char *filename, char type);
|
||||
extern void fc_backup_oldfile(char *filename);
|
||||
extern void fc_set_default_kanjicode(int c);
|
||||
extern void fc_init(const char *name);
|
||||
extern FILE *fc_open(const char *fname_utf8, char type);
|
||||
extern void fc_backup_oldfile(const char *filename);
|
||||
|
||||
#endif /* !__FILECHECK_H__ */
|
||||
|
||||
+2
-5
@@ -41,18 +41,15 @@ struct _FONT {
|
||||
boolean antialiase_on;
|
||||
|
||||
char *name[FONTTYPEMAX];
|
||||
boolean isJISX0213[FONTTYPEMAX];
|
||||
char face[FONTTYPEMAX];
|
||||
|
||||
void (*sel_font)(int type, int size);
|
||||
|
||||
struct agsurface *(*get_glyph)(unsigned char *str);
|
||||
struct agsurface *(*get_glyph)(const unsigned char *str);
|
||||
|
||||
int (*draw_glyph)(int x, int y, unsigned char *str, int col);
|
||||
int (*draw_glyph)(int x, int y, const unsigned char *str, int col);
|
||||
|
||||
boolean (*self_drawable)();
|
||||
|
||||
int (*codeconv[FONTTYPEMAX])(unsigned char **msg);
|
||||
};
|
||||
|
||||
typedef struct _FONT FONT;
|
||||
|
||||
+12
-46
@@ -35,7 +35,6 @@
|
||||
#include "font.h"
|
||||
#include "ags.h"
|
||||
|
||||
extern int cp932tosjis0213(int code);
|
||||
extern const unsigned short *s2u[];
|
||||
|
||||
typedef struct {
|
||||
@@ -60,7 +59,7 @@ 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(unsigned char **msg) {
|
||||
static int toUnicode(const unsigned char **msg) {
|
||||
int code;
|
||||
|
||||
if (**msg >= 0xa0 && **msg <= 0xdf) {
|
||||
@@ -74,51 +73,17 @@ static int toUnicode(unsigned char **msg) {
|
||||
return code;
|
||||
}
|
||||
|
||||
static int toSJIS(unsigned char **msg) {
|
||||
int code;
|
||||
|
||||
if (**msg >= 0xa0 && **msg <= 0xdf) {
|
||||
code = **msg; (*msg)++;
|
||||
} else if (**msg & 0x80) {
|
||||
code = (**msg << 8) + *(*msg+1);
|
||||
(*msg) += 2;
|
||||
} else {
|
||||
code = **msg; (*msg)++;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static int toSJIS0213(unsigned char **msg) {
|
||||
int code;
|
||||
|
||||
if (**msg >= 0xa0 && **msg <= 0xdf) {
|
||||
code = **msg; (*msg)++;
|
||||
} else if (**msg & 0x80) {
|
||||
code = (**msg << 8) + *(*msg+1);
|
||||
(*msg) += 2;
|
||||
} else {
|
||||
code = **msg; (*msg)++;
|
||||
}
|
||||
return cp932tosjis0213(code);
|
||||
}
|
||||
|
||||
static void select_charmap(FT_Face f, int type) {
|
||||
static boolean select_charmap(FT_Face f, int type) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < f->num_charmaps; i++) {
|
||||
FT_CharMap map = f->charmaps[i];
|
||||
if (map->encoding == ft_encoding_sjis) {
|
||||
FT_Select_Charmap(f, ft_encoding_sjis);
|
||||
this->codeconv[type] = (this->isJISX0213[type] ?
|
||||
toSJIS0213 : toSJIS);
|
||||
return;
|
||||
} else if (map->encoding == ft_encoding_unicode) {
|
||||
if (map->encoding == ft_encoding_unicode) {
|
||||
FT_Select_Charmap(f, ft_encoding_unicode);
|
||||
this->codeconv[type] = toUnicode;
|
||||
return;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
SYSERROR("CharMap encoding is neither sjis nor unicode\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void font_insert(int size, int type, FT_Face face) {
|
||||
@@ -172,11 +137,12 @@ static void font_ttf_sel_font(int type, int size) {
|
||||
return;
|
||||
}
|
||||
|
||||
select_charmap(face, type);
|
||||
if (!select_charmap(face, type))
|
||||
SYSERROR("TTfont %s has no unicode charmap\n", name);
|
||||
|
||||
err = FT_Set_Pixel_Sizes(face, 0, size);
|
||||
if (err) {
|
||||
WARNING("TTfont %s contains only fixed size(%d) font.\n",name, face->size);
|
||||
WARNING("Font %s contains only fixed size(%d) font.\n",name, face->size);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -231,21 +197,21 @@ static void clear_canvas(void) {
|
||||
memset(img_glyph.pixel, 0, GLYPH_PIXMAP_WIDTH * GLYPH_PIXMAP_HEIGHT);
|
||||
}
|
||||
|
||||
static agsurface_t *font_ttf_get_glyph(unsigned char *_msg) {
|
||||
static agsurface_t *font_ttf_get_glyph(const unsigned char *_msg) {
|
||||
FT_GlyphSlot slot;
|
||||
FT_UShort code;
|
||||
FT_Error err;
|
||||
FT_Pixel_Mode pixelmode;
|
||||
FT_Int loadflag;
|
||||
int x = 0;
|
||||
unsigned char *msg = _msg;
|
||||
const unsigned char *msg = _msg;
|
||||
|
||||
if (fontset == NULL) return &img_glyph;
|
||||
|
||||
clear_canvas();
|
||||
|
||||
while (*msg) {
|
||||
code = this->codeconv[fontset->type](&msg);
|
||||
code = toUnicode(&msg);
|
||||
|
||||
if (this->antialiase_on) {
|
||||
loadflag = FT_LOAD_RENDER;
|
||||
@@ -300,7 +266,7 @@ static agsurface_t *font_ttf_get_glyph(unsigned char *_msg) {
|
||||
return &img_glyph;
|
||||
}
|
||||
|
||||
static int font_ttf_draw_glyph(int x, int y, unsigned char *str, int col) {
|
||||
static int font_ttf_draw_glyph(int x, int y, const unsigned char *str, int col) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+8
-4
@@ -69,16 +69,18 @@ static void font_sdlttf_sel_font(int type, int size) {
|
||||
}
|
||||
}
|
||||
|
||||
static agsurface_t *font_sdlttf_get_glyph(unsigned char *msg) {
|
||||
static agsurface_t *font_sdlttf_get_glyph(const unsigned char *msg) {
|
||||
static SDL_Surface *fs;
|
||||
static agsurface_t result;
|
||||
|
||||
if (!fontset)
|
||||
return NULL;
|
||||
if (fs) {
|
||||
SDL_FreeSurface(fs);
|
||||
fs = NULL;
|
||||
}
|
||||
|
||||
BYTE* conv = sjis2lang(msg);
|
||||
BYTE* conv = sjis2utf(msg);
|
||||
|
||||
SDL_Color color = {255, 255, 255, 0};
|
||||
if (this->antialiase_on) {
|
||||
@@ -140,7 +142,7 @@ 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, unsigned char *str, int cl) {
|
||||
static int font_sdlttf_draw_glyph(int x, int y, const unsigned char *str, int cl) {
|
||||
SDL_Surface *fs;
|
||||
SDL_Rect r_src, r_dst;
|
||||
int w, h, maxy;
|
||||
@@ -148,8 +150,10 @@ static int font_sdlttf_draw_glyph(int x, int y, unsigned char *str, int cl) {
|
||||
|
||||
if (!*str)
|
||||
return 0;
|
||||
if (!fontset)
|
||||
return 0;
|
||||
|
||||
conv = sjis2lang(str);
|
||||
conv = sjis2utf(str);
|
||||
if (this->antialiase_on) {
|
||||
fs = TTF_RenderUTF8_Blended(fontset->id, conv, sdl_col[cl]);
|
||||
} else {
|
||||
|
||||
+4
-4
@@ -151,13 +151,13 @@ static agsurface_t *get_drawn_glyph(const char *str, int w) {
|
||||
return dst;
|
||||
}
|
||||
|
||||
static agsurface_t *font_x11_get_glyph(unsigned char *str) {
|
||||
static agsurface_t *font_x11_get_glyph(const unsigned char *str) {
|
||||
agsurface_t *dst;
|
||||
int w;
|
||||
BYTE *conv;
|
||||
|
||||
/* convert string code from sjis to utf-8 */
|
||||
conv = sjis2lang(str);
|
||||
conv = sjis2utf(str);
|
||||
|
||||
w = XmbTextEscapement(fontset, conv, strlen(conv));
|
||||
|
||||
@@ -182,12 +182,12 @@ static agsurface_t *font_x11_get_glyph(unsigned char *str) {
|
||||
return &img_glyph;
|
||||
}
|
||||
|
||||
static int font_x11_draw_glyph(int x, int y, unsigned char *str, int col) {
|
||||
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 = sjis2lang(str);
|
||||
conv = sjis2utf(str);
|
||||
|
||||
w = XmbTextEscapement(fontset, conv, strlen(conv));
|
||||
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
/*
|
||||
* gameresource.c Game Resource (*.gr) file
|
||||
*
|
||||
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
|
||||
* 1998- <masaki-c@is.aist-nara.ac.jp>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gameresource.h"
|
||||
#include "system.h"
|
||||
|
||||
static void storeDataName(GameResource *gr, int type, int no, char *src) {
|
||||
gr->game_fname[type][no] = strdup(src);
|
||||
gr->cnt[type] = max(no + 1, gr->cnt[type]);
|
||||
}
|
||||
|
||||
static void storeSaveName(GameResource *gr, int no, char *src) {
|
||||
char *home_dir = "";
|
||||
char *path = NULL;
|
||||
|
||||
if (*src == '~') {
|
||||
home_dir = getenv("HOME");
|
||||
if (NULL == (path = malloc(strlen(home_dir) + strlen(src) + 1))) {
|
||||
NOMEMERR();
|
||||
}
|
||||
sprintf(path, "%s%s", home_dir, src+1);
|
||||
gr->save_fname[no] = strdup(path);
|
||||
src = path;
|
||||
} else {
|
||||
gr->save_fname[no] = strdup(src);
|
||||
}
|
||||
|
||||
if (no == 0) {
|
||||
char *b = strrchr(src, '/');
|
||||
if (b) {
|
||||
*b = '\0';
|
||||
gr->save_path = strdup(src);
|
||||
} else {
|
||||
gr->save_path = ".";
|
||||
}
|
||||
}
|
||||
if (path) free(path);
|
||||
}
|
||||
|
||||
boolean initGameResourceFromDir(GameResource *gr, DIR *dir, struct dirent *(*p_readdir)(DIR *)) {
|
||||
memset(gr, 0, sizeof(GameResource));
|
||||
|
||||
struct dirent* d;
|
||||
while ((d = p_readdir(dir))) {
|
||||
char *filename = d->d_name;
|
||||
int len = strlen(filename);
|
||||
if (strcasecmp(filename, "adisk.ald") == 0) {
|
||||
storeDataName(gr, DRIFILE_SCO, 0, filename);
|
||||
} else if (strcasecmp(filename, "System39.ain") == 0) {
|
||||
gr->ain = strdup(filename);
|
||||
} else if (strcasecmp(filename, "SACTEFAM.KLD") == 0) {
|
||||
gr->sact01 = strdup(filename);
|
||||
} else if (strcasecmp(filename, "System39.ini") == 0) {
|
||||
gr->init = strdup(filename);
|
||||
} else if (len >= 4 && strcasecmp(filename + len - 4, ".wai") == 0) {
|
||||
gr->wai = strdup(filename);
|
||||
} else if (len >= 4 && strcasecmp(filename + len - 4, ".bgi") == 0) {
|
||||
gr->bgi = strdup(filename);
|
||||
} else if (len >= 5 && strcasecmp(filename + len - 4, ".alk") == 0) {
|
||||
if (!isdigit(filename[len - 5])) continue;
|
||||
gr->alk[filename[len - 5] - '0'] = strdup(filename);
|
||||
} else if (len >= 6 && strcasecmp(filename + len - 4, ".ald") == 0) {
|
||||
int dno = toupper(filename[len - 5]) - 'A';
|
||||
if (dno < 0 || dno >= DRIFILEMAX) continue;
|
||||
switch (toupper(filename[len - 6])) {
|
||||
case 'S':
|
||||
storeDataName(gr, DRIFILE_SCO, dno, filename);
|
||||
break;
|
||||
case 'G':
|
||||
storeDataName(gr, DRIFILE_CG, dno, filename);
|
||||
break;
|
||||
case 'W':
|
||||
storeDataName(gr, DRIFILE_WAVE, dno, filename);
|
||||
break;
|
||||
case 'M':
|
||||
storeDataName(gr, DRIFILE_MIDI, dno, filename);
|
||||
break;
|
||||
case 'D':
|
||||
storeDataName(gr, DRIFILE_DATA, dno, filename);
|
||||
break;
|
||||
case 'R':
|
||||
storeDataName(gr, DRIFILE_RSC, dno, filename);
|
||||
break;
|
||||
case 'B':
|
||||
storeDataName(gr, DRIFILE_BGM, dno, filename);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < SAVE_MAXNUMBER; i++) {
|
||||
char buf[] = "asleep.asd";
|
||||
buf[0] = 'a' + i;
|
||||
storeSaveName(gr, i, buf);
|
||||
}
|
||||
|
||||
return (gr->cnt[DRIFILE_SCO] > 0) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
static void trimRight(char *str) {
|
||||
for (char *p = str + strlen(str) - 1; p >= str && isspace(*p); p--)
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
static boolean initGameResourceFromFile(GameResource *gr, FILE *fp, const char *gr_fname) {
|
||||
int linecnt = 0, dno;
|
||||
char line[256];
|
||||
char key[256], path[256];
|
||||
|
||||
memset(gr, 0, sizeof(GameResource));
|
||||
|
||||
while (fgets(line, 255, fp) != NULL) {
|
||||
linecnt++;
|
||||
if (line[0] == '#') continue;
|
||||
path[0] = '\0';
|
||||
sscanf(line, "%s %[^\n]", key, path);
|
||||
if (path[0] == '\0') continue;
|
||||
trimRight(path);
|
||||
if (0 == strncmp(key, "Scenario", 8)) {
|
||||
dno = key[8] - 'A';
|
||||
if (dno < 0 || dno >= DRIFILEMAX) goto errexit;
|
||||
storeDataName(gr, DRIFILE_SCO, dno, path);
|
||||
} else if (0 == strncmp(key, "Graphics", 8)) {
|
||||
dno = key[8] - 'A';
|
||||
if (dno < 0 || dno >= DRIFILEMAX) goto errexit;
|
||||
storeDataName(gr, DRIFILE_CG, dno, path);
|
||||
} else if (0 == strncmp(key, "Wave", 4)) {
|
||||
dno = key[4] - 'A';
|
||||
if (dno < 0 || dno >= DRIFILEMAX) goto errexit;
|
||||
storeDataName(gr, DRIFILE_WAVE, dno, path);
|
||||
} else if (0 == strncmp(key, "Midi", 4)) {
|
||||
dno = key[4] - 'A';
|
||||
if (dno < 0 || dno >= DRIFILEMAX) goto errexit;
|
||||
storeDataName(gr, DRIFILE_MIDI, dno, path);
|
||||
} else if (0 == strncmp(key, "Data", 4)) {
|
||||
dno = key[4] - 'A';
|
||||
if (dno < 0 || dno >= DRIFILEMAX) goto errexit;
|
||||
storeDataName(gr, DRIFILE_DATA, dno, path);
|
||||
} else if (0 == strncmp(key, "Resource", 8)) {
|
||||
dno = key[8] - 'A';
|
||||
if (dno < 0 || dno >= DRIFILEMAX) goto errexit;
|
||||
storeDataName(gr, DRIFILE_RSC, dno, path);
|
||||
} else if (0 == strncmp(key, "BGM", 3)) {
|
||||
dno = key[3] - 'A';
|
||||
if (dno < 0 || dno >= DRIFILEMAX) goto errexit;
|
||||
storeDataName(gr, DRIFILE_BGM, dno, path);
|
||||
} else if (0 == strncmp(key, "Save", 4)) {
|
||||
dno = key[4] - 'A';
|
||||
if (dno < 0 || dno >= DRIFILEMAX) goto errexit;
|
||||
storeSaveName(gr, dno, path);
|
||||
} else if (0 == strncmp(key, "Ain", 3)) {
|
||||
gr->ain = strdup(path);
|
||||
} else if (0 == strncmp(key, "WAIA", 4)) {
|
||||
gr->wai = strdup(path);
|
||||
} else if (0 == strncmp(key, "BGIA", 4)) {
|
||||
gr->bgi = strdup(path);
|
||||
} else if (0 == strncmp(key, "SACT01", 6)) {
|
||||
gr->sact01 = strdup(path);
|
||||
} else if (0 == strncmp(key, "Init", 4)) {
|
||||
gr->init = strdup(path);
|
||||
} else if (0 == strncmp(key, "ALK", 3)) {
|
||||
dno = key[4] - '0';
|
||||
if (dno < 0 || dno >= 10) goto errexit;
|
||||
gr->alk[dno] = strdup(path);
|
||||
} else {
|
||||
goto errexit;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
errexit:
|
||||
SYSERROR("Illigal resource at line(%d) file<%s>\n", linecnt, gr_fname);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
boolean initGameResource(GameResource *gr, const char *gr_fname) {
|
||||
FILE *fp = fopen(gr_fname, "r");
|
||||
if (fp) {
|
||||
boolean result = initGameResourceFromFile(gr, fp, gr_fname);
|
||||
fclose(fp);
|
||||
return result;
|
||||
}
|
||||
DIR *dir = opendir(".");
|
||||
if (dir) {
|
||||
boolean result = initGameResourceFromDir(gr, dir, readdir);
|
||||
closedir(dir);
|
||||
return result;
|
||||
}
|
||||
SYSERROR("Game Resource File open failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* gameresource.h Game Resource (*.gr) file
|
||||
*
|
||||
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
|
||||
* 1998- <masaki-c@is.aist-nara.ac.jp>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __GAMERESOURCE_H__
|
||||
#define __GAMERESOURCE_H__
|
||||
|
||||
#include <dirent.h>
|
||||
#include "portab.h"
|
||||
#include "ald_manager.h"
|
||||
#include "savedata.h"
|
||||
|
||||
typedef struct {
|
||||
const char *game_fname[DRIFILETYPEMAX][DRIFILEMAX];
|
||||
int cnt[DRIFILETYPEMAX];
|
||||
const char *save_path;
|
||||
const char *save_fname[SAVE_MAXNUMBER];
|
||||
const char *ain;
|
||||
const char *wai;
|
||||
const char *bgi;
|
||||
const char *sact01;
|
||||
const char *init;
|
||||
const char *alk[10];
|
||||
} GameResource;
|
||||
|
||||
boolean initGameResource(GameResource *gr, const char *gr_fname);
|
||||
boolean initGameResourceFromDir(GameResource *gr, DIR *dir, struct dirent *(*p_readdir)(DIR *));
|
||||
|
||||
#endif /* !__GAMERESOURCE_H__ */
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* 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 "gameresource.h"
|
||||
#include "unittest.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void initGameResource_test(void) {
|
||||
GameResource gr;
|
||||
ASSERT_TRUE(initGameResource(&gr, "testdata/test.gr"));
|
||||
|
||||
ASSERT_EQUAL(gr.cnt[DRIFILE_SCO], 1);
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_SCO][0], "fooSA.ALD");
|
||||
ASSERT_EQUAL(gr.cnt[DRIFILE_CG], 2);
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_CG][0], "fooGA.ALD");
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_CG][1], "fooGB.ALD");
|
||||
ASSERT_EQUAL(gr.cnt[DRIFILE_WAVE], 26);
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_WAVE][0], "fooWA.ALD");
|
||||
for (int i = 1; i <= 24; i++)
|
||||
ASSERT_NULL(gr.game_fname[DRIFILE_WAVE][i]);
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_WAVE][25], "fooWZ.ALD");
|
||||
ASSERT_EQUAL(gr.cnt[DRIFILE_MIDI], 3);
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_MIDI][2], "fooMC.ALD");
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_DATA][0], "file name with whitespaces");
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_RSC][0], "this line has whitespaces at end of line");
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_BGM][0], "/path/to/fooBA.ALD");
|
||||
|
||||
ASSERT_STRCMP(gr.ain, "System39.ain");
|
||||
ASSERT_STRCMP(gr.wai, "foo_WA.WAI");
|
||||
ASSERT_STRCMP(gr.bgi, "foo_BA.BGI");
|
||||
ASSERT_STRCMP(gr.sact01, "SACTEFAM.KLD");
|
||||
ASSERT_STRCMP(gr.init, "System39.ini");
|
||||
ASSERT_STRCMP(gr.alk[0], "0.alk");
|
||||
for (int i = 1; i <= 8; i++)
|
||||
ASSERT_NULL(gr.alk[i]);
|
||||
ASSERT_STRCMP(gr.alk[9], "9.alk");
|
||||
|
||||
ASSERT_STRCMP(gr.save_fname[0], "/home/kichikuou/save/foo_sa.asd");
|
||||
for (int i = 1; i <= 24; i++)
|
||||
ASSERT_NULL(gr.save_fname[i]);
|
||||
ASSERT_STRCMP(gr.save_fname[25], "/tmp/foo_sz.asd");
|
||||
// save_path is determined based on save_fname[0].
|
||||
ASSERT_STRCMP(gr.save_path, "/home/kichikuou/save");
|
||||
}
|
||||
|
||||
static struct dirent *mockReaddir(DIR *dir) {
|
||||
static struct dirent ent;
|
||||
const char ***entries = (const char ***)dir;
|
||||
if (**entries) {
|
||||
strcpy(ent.d_name, **entries);
|
||||
(*entries)++;
|
||||
return &ent;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void initGameResourceFromDir_test(void) {
|
||||
const char *files[] = {
|
||||
"ADISK.ALD",
|
||||
"FOOSB.ALD",
|
||||
"foogz.ald",
|
||||
"WA.ALD",
|
||||
"unknownXA.ald",
|
||||
"a.ald",
|
||||
".ald",
|
||||
"a",
|
||||
"SYSTEM39.AIN",
|
||||
"foo_WA.WAI",
|
||||
"foo_BA.BGI",
|
||||
"SACTEFAM.KLD",
|
||||
"System39.ini",
|
||||
"foo1.alk",
|
||||
"0.alk",
|
||||
".alk",
|
||||
NULL
|
||||
};
|
||||
const char **dir = files;
|
||||
GameResource gr;
|
||||
ASSERT_TRUE(initGameResourceFromDir(&gr, (DIR *)&dir, mockReaddir));
|
||||
ASSERT_EQUAL(gr.cnt[DRIFILE_SCO], 2);
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_SCO][0], "ADISK.ALD");
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_SCO][1], "FOOSB.ALD");
|
||||
ASSERT_EQUAL(gr.cnt[DRIFILE_CG], 26);
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_CG][25], "foogz.ald");
|
||||
ASSERT_EQUAL(gr.cnt[DRIFILE_WAVE], 1);
|
||||
ASSERT_STRCMP(gr.game_fname[DRIFILE_WAVE][0], "WA.ALD");
|
||||
for (int i = 0; i < 26; i++) {
|
||||
char buf[16];
|
||||
sprintf(buf, "%csleep.asd", 'a' + i);
|
||||
ASSERT_STRCMP(gr.save_fname[i], buf);
|
||||
}
|
||||
ASSERT_STRCMP(gr.save_path, ".");
|
||||
ASSERT_STRCMP(gr.ain, "SYSTEM39.AIN");
|
||||
ASSERT_STRCMP(gr.wai, "foo_WA.WAI");
|
||||
ASSERT_STRCMP(gr.bgi, "foo_BA.BGI");
|
||||
ASSERT_STRCMP(gr.sact01, "SACTEFAM.KLD");
|
||||
ASSERT_STRCMP(gr.init, "System39.ini");
|
||||
ASSERT_STRCMP(gr.alk[0], "0.alk");
|
||||
ASSERT_STRCMP(gr.alk[1], "foo1.alk");
|
||||
for (int i = 2; i < 10; i++)
|
||||
ASSERT_NULL(gr.alk[i]);
|
||||
}
|
||||
|
||||
void gameresource_test(void) {
|
||||
#ifdef _WIN32
|
||||
_putenv("HOME=/home/kichikuou");
|
||||
#else
|
||||
setenv("HOME", "/home/kichikuou", 1);
|
||||
#endif
|
||||
|
||||
initGameResource_test();
|
||||
initGameResourceFromDir_test();
|
||||
}
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
#define GT_TOSHIN2 "闘神都市Ⅱ for Win95 "
|
||||
#define GT_RANCE4 "Rance4 -教団の遺産- For Win95 "
|
||||
#define GT_RANCE5D "ランス5D (SR)"
|
||||
#define GT_TOSHIN2 "闘神都市Ⅱ for Win95 "
|
||||
#define GT_RANCE4 "Rance4 -教団の遺産- For Win95 "
|
||||
#define GT_RANCE5D "ランス5D (SR)"
|
||||
#define GT_ESUKA "-BeatAngelEscalayer-"
|
||||
#define GT_RANCE3_ENG "Rance3"
|
||||
#define GT_RANCE4_ENG "Rance4 -Legacy of the Sect- For Win95 "
|
||||
|
||||
+139
-590
@@ -27,592 +27,120 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "hankaku.h"
|
||||
|
||||
/* defined by hankan2sjis.c */
|
||||
extern char *hankana2sjis(int index);
|
||||
|
||||
static BYTE hankakutable[3][192][2] = {{
|
||||
{0x00, 0x20}, /* SPC */
|
||||
{0x00, 0xa4}, /* 、 */
|
||||
{0x00, 0xa2}, /* 。 */
|
||||
{0x00, 0x2c}, /* , */
|
||||
{0x00, 0x2e}, /* . */
|
||||
{0x00, 0xa5}, /* ・ */
|
||||
{0x00, 0x3a}, /* : */
|
||||
{0x00, 0x3b}, /* ; */
|
||||
{0x00, 0x3f}, /* ? */
|
||||
{0x00, 0x21}, /* ! */
|
||||
{0x00, 0xde}, /* ゛ */
|
||||
{0x00, 0xdf}, /* ゜ */
|
||||
{0x00, 0x27}, /* ' */
|
||||
{0x00, 0x60}, /* ` */
|
||||
{0x81, 0x4e},
|
||||
{0x00, 0x5d}, /* ^ */
|
||||
{0x00, 0x7e}, /* ~ */
|
||||
{0x00, 0x5f}, /* _ */
|
||||
{0x81, 0x52},
|
||||
{0x81, 0x53},
|
||||
{0x81, 0x54},
|
||||
{0x81, 0x55},
|
||||
{0x81, 0x56},
|
||||
{0x81, 0x57},
|
||||
{0x81, 0x58},
|
||||
{0x81, 0x59},
|
||||
{0x81, 0x5a},
|
||||
{0x00, 0xb0}, /* ー */
|
||||
{0x81, 0x5c},
|
||||
{0x81, 0x5d},
|
||||
{0x00, 0x2f}, /* / */
|
||||
{0x81, 0x5f},
|
||||
{0x81, 0x60},
|
||||
{0x81, 0x61},
|
||||
{0x00, 0x7c}, /* | */
|
||||
{0x81, 0x63},
|
||||
{0x81, 0x64},
|
||||
{0x81, 0x65},
|
||||
{0x00, 0x27}, /* ' */
|
||||
{0x81, 0x67},
|
||||
{0x00, 0x22}, /* ″ */
|
||||
{0x00, 0x28}, /* ( */
|
||||
{0x00, 0x29}, /* ) */
|
||||
{0x81, 0x6b},
|
||||
{0x81, 0x6c},
|
||||
{0x00, 0x5b}, /* [ */
|
||||
{0x00, 0x5d}, /* ] */
|
||||
{0x00, 0x7b}, /* { */
|
||||
{0x00, 0x7d}, /* } */
|
||||
{0x81, 0x71},
|
||||
{0x81, 0x72},
|
||||
{0x81, 0x73},
|
||||
{0x81, 0x74},
|
||||
{0x00, 0xa2}, /* 「 */
|
||||
{0x00, 0xa3}, /* 」 */
|
||||
{0x81, 0x77},
|
||||
{0x81, 0x78},
|
||||
{0x81, 0x79},
|
||||
{0x81, 0x7a},
|
||||
{0x00, 0x2b}, /* + */
|
||||
{0x00, 0x2d}, /* - */
|
||||
{0x81, 0x7d},
|
||||
{0x81, 0x7e},
|
||||
{0x81, 0x7f},
|
||||
{0x81, 0x80},
|
||||
{0x00, 0x3d}, /* = */
|
||||
{0x81, 0x82},
|
||||
{0x00, 0x3c}, /* < */
|
||||
{0x00, 0x3e}, /* > */
|
||||
{0x81, 0x85},
|
||||
{0x81, 0x86},
|
||||
{0x81, 0x87},
|
||||
{0x81, 0x88},
|
||||
{0x81, 0x89},
|
||||
{0x81, 0x8a},
|
||||
{0x81, 0x8b},
|
||||
{0x81, 0x8c},
|
||||
{0x81, 0x8d},
|
||||
{0x81, 0x8e},
|
||||
{0x00, 0x5c}, /* ¥ */
|
||||
{0x00, 0x24}, /* $ */
|
||||
{0x81, 0x91},
|
||||
{0x81, 0x92},
|
||||
{0x00, 0x25}, /* % */
|
||||
{0x00, 0x23}, /* # */
|
||||
{0x00, 0x26}, /* & */
|
||||
{0x00, 0x2a}, /* * */
|
||||
{0x00, 0x40}, /* @ */
|
||||
{0x81, 0x98},
|
||||
{0x81, 0x99},
|
||||
{0x81, 0x9a},
|
||||
{0x81, 0x9b},
|
||||
{0x81, 0x9c},
|
||||
{0x81, 0x9d},
|
||||
{0x81, 0x9e},
|
||||
{0x81, 0x9f},
|
||||
{0x81, 0xa0},
|
||||
{0x81, 0xa1},
|
||||
{0x81, 0xa2},
|
||||
{0x81, 0xa3},
|
||||
{0x81, 0xa4},
|
||||
{0x81, 0xa5},
|
||||
{0x81, 0xa6},
|
||||
{0x81, 0xa7},
|
||||
{0x81, 0xa8},
|
||||
{0x81, 0xa9},
|
||||
{0x81, 0xaa},
|
||||
{0x81, 0xab},
|
||||
{0x81, 0xac},
|
||||
{0x81, 0xad},
|
||||
{0x81, 0xae},
|
||||
{0x81, 0xaf},
|
||||
{0x81, 0xb0},
|
||||
{0x81, 0xb1},
|
||||
{0x81, 0xb2},
|
||||
{0x81, 0xb3},
|
||||
{0x81, 0xb4},
|
||||
{0x81, 0xb5},
|
||||
{0x81, 0xb6},
|
||||
{0x81, 0xb7},
|
||||
{0x81, 0xb8},
|
||||
{0x81, 0xb9},
|
||||
{0x81, 0xba},
|
||||
{0x81, 0xbb},
|
||||
{0x81, 0xbc},
|
||||
{0x81, 0xbd},
|
||||
{0x81, 0xbe},
|
||||
{0x81, 0xbf},
|
||||
{0x81, 0xc0},
|
||||
{0x81, 0xc1},
|
||||
{0x81, 0xc2},
|
||||
{0x81, 0xc3},
|
||||
{0x81, 0xc4},
|
||||
{0x81, 0xc5},
|
||||
{0x81, 0xc6},
|
||||
{0x81, 0xc7},
|
||||
{0x81, 0xc8},
|
||||
{0x81, 0xc9},
|
||||
{0x81, 0xca},
|
||||
{0x81, 0xcb},
|
||||
{0x81, 0xcc},
|
||||
{0x81, 0xcd},
|
||||
{0x81, 0xce},
|
||||
{0x81, 0xcf},
|
||||
{0x81, 0xd0},
|
||||
{0x81, 0xd1},
|
||||
{0x81, 0xd2},
|
||||
{0x81, 0xd3},
|
||||
{0x81, 0xd4},
|
||||
{0x81, 0xd5},
|
||||
{0x81, 0xd6},
|
||||
{0x81, 0xd7},
|
||||
{0x81, 0xd8},
|
||||
{0x81, 0xd9},
|
||||
{0x81, 0xda},
|
||||
{0x81, 0xdb},
|
||||
{0x81, 0xdc},
|
||||
{0x81, 0xdd},
|
||||
{0x81, 0xde},
|
||||
{0x81, 0xdf},
|
||||
{0x81, 0xe0},
|
||||
{0x81, 0xe1},
|
||||
{0x81, 0xe2},
|
||||
{0x81, 0xe3},
|
||||
{0x81, 0xe4},
|
||||
{0x81, 0xe5},
|
||||
{0x81, 0xe6},
|
||||
{0x81, 0xe7},
|
||||
{0x81, 0xe8},
|
||||
{0x81, 0xe9},
|
||||
{0x81, 0xea},
|
||||
{0x81, 0xeb},
|
||||
{0x81, 0xec},
|
||||
{0x81, 0xed},
|
||||
{0x81, 0xee},
|
||||
{0x81, 0xef},
|
||||
{0x81, 0xf0},
|
||||
{0x81, 0xf1},
|
||||
{0x81, 0xf2},
|
||||
{0x81, 0xf3},
|
||||
{0x81, 0xf4},
|
||||
{0x81, 0xf5},
|
||||
{0x81, 0xf6},
|
||||
{0x81, 0xf7},
|
||||
{0x81, 0xf8},
|
||||
{0x81, 0xf9},
|
||||
{0x81, 0xfa},
|
||||
{0x81, 0xfb},
|
||||
{0x81, 0xfc},
|
||||
{0x81, 0xfd},
|
||||
{0x81, 0xfe},
|
||||
{0x81, 0xff}
|
||||
},{
|
||||
{0x82, 0x40},
|
||||
{0x82, 0x41},
|
||||
{0x82, 0x42},
|
||||
{0x82, 0x43},
|
||||
{0x82, 0x44},
|
||||
{0x82, 0x45},
|
||||
{0x82, 0x46},
|
||||
{0x82, 0x47},
|
||||
{0x82, 0x48},
|
||||
{0x82, 0x49},
|
||||
{0x82, 0x4a},
|
||||
{0x82, 0x4b},
|
||||
{0x82, 0x4c},
|
||||
{0x82, 0x4d},
|
||||
{0x82, 0x4e},
|
||||
{0x00, 0x30}, /* 0 */
|
||||
{0x00, 0x31}, /* 1 */
|
||||
{0x00, 0x32}, /* 2 */
|
||||
{0x00, 0x33}, /* 3 */
|
||||
{0x00, 0x34}, /* 4 */
|
||||
{0x00, 0x35}, /* 5 */
|
||||
{0x00, 0x36}, /* 6 */
|
||||
{0x00, 0x37}, /* 7 */
|
||||
{0x00, 0x38}, /* 8 */
|
||||
{0x00, 0x39}, /* 9 */
|
||||
{0x82, 0x59},
|
||||
{0x82, 0x5a},
|
||||
{0x82, 0x5b},
|
||||
{0x82, 0x5c},
|
||||
{0x82, 0x5d},
|
||||
{0x82, 0x5e},
|
||||
{0x82, 0x5f},
|
||||
{0x00, 0x41}, /* A */
|
||||
{0x00, 0x42}, /* B */
|
||||
{0x00, 0x43}, /* C */
|
||||
{0x00, 0x44}, /* D */
|
||||
{0x00, 0x45}, /* E */
|
||||
{0x00, 0x46}, /* F */
|
||||
{0x00, 0x47}, /* G */
|
||||
{0x00, 0x48}, /* H */
|
||||
{0x00, 0x49}, /* I */
|
||||
{0x00, 0x4a}, /* J */
|
||||
{0x00, 0x4b}, /* K */
|
||||
{0x00, 0x4c}, /* L */
|
||||
{0x00, 0x4d}, /* M */
|
||||
{0x00, 0x4e}, /* N */
|
||||
{0x00, 0x4f}, /* O */
|
||||
{0x00, 0x50}, /* P */
|
||||
{0x00, 0x51}, /* Q */
|
||||
{0x00, 0x52}, /* R */
|
||||
{0x00, 0x53}, /* S */
|
||||
{0x00, 0x54}, /* T */
|
||||
{0x00, 0x55}, /* U */
|
||||
{0x00, 0x56}, /* V */
|
||||
{0x00, 0x57}, /* W */
|
||||
{0x00, 0x58}, /* X */
|
||||
{0x00, 0x59}, /* Y */
|
||||
{0x00, 0x5a}, /* Z */
|
||||
{0x82, 0x7a},
|
||||
{0x82, 0x7b},
|
||||
{0x82, 0x7c},
|
||||
{0x82, 0x7d},
|
||||
{0x82, 0x7e},
|
||||
{0x82, 0x7f},
|
||||
{0x82, 0x80},
|
||||
{0x00, 0x61}, /* a */
|
||||
{0x00, 0x62}, /* b */
|
||||
{0x00, 0x63}, /* c */
|
||||
{0x00, 0x64}, /* d */
|
||||
{0x00, 0x65}, /* e */
|
||||
{0x00, 0x66}, /* f */
|
||||
{0x00, 0x67}, /* g */
|
||||
{0x00, 0x68}, /* h */
|
||||
{0x00, 0x69}, /* i */
|
||||
{0x00, 0x6a}, /* j */
|
||||
{0x00, 0x6b}, /* k */
|
||||
{0x00, 0x6c}, /* l */
|
||||
{0x00, 0x6d}, /* m */
|
||||
{0x00, 0x6e}, /* n */
|
||||
{0x00, 0x6f}, /* o */
|
||||
{0x00, 0x70}, /* p */
|
||||
{0x00, 0x71}, /* q */
|
||||
{0x00, 0x72}, /* r */
|
||||
{0x00, 0x73}, /* s */
|
||||
{0x00, 0x74}, /* t */
|
||||
{0x00, 0x75}, /* u */
|
||||
{0x00, 0x76}, /* v */
|
||||
{0x00, 0x77}, /* w */
|
||||
{0x00, 0x78}, /* x */
|
||||
{0x00, 0x79}, /* y */
|
||||
{0x00, 0x7a}, /* z */
|
||||
{0x82, 0x9b},
|
||||
{0x82, 0x9c},
|
||||
{0x82, 0x9d},
|
||||
{0x82, 0x9e},
|
||||
{0x82, 0x9f}, /* ぁ */
|
||||
{0x82, 0xa0}, /* あ */
|
||||
{0x82, 0xa1}, /* ぃ */
|
||||
{0x82, 0xa2}, /* い */
|
||||
{0x82, 0xa3}, /* ぅ */
|
||||
{0x82, 0xa4}, /* う */
|
||||
{0x82, 0xa5}, /* ぇ */
|
||||
{0x82, 0xa6}, /* え */
|
||||
{0x82, 0xa7}, /* ぉ */
|
||||
{0x82, 0xa8}, /* お */
|
||||
{0x82, 0xa9}, /* か */
|
||||
{0x82, 0xaa},
|
||||
{0x82, 0xab}, /* き */
|
||||
{0x82, 0xac},
|
||||
{0x82, 0xad}, /* く */
|
||||
{0x82, 0xae},
|
||||
{0x82, 0xaf}, /* け */
|
||||
{0x82, 0xb0},
|
||||
{0x82, 0xb1}, /* こ */
|
||||
{0x82, 0xb2},
|
||||
{0x82, 0xb3}, /* さ */
|
||||
{0x82, 0xb4},
|
||||
{0x82, 0xb4}, /* し */
|
||||
{0x82, 0xb6},
|
||||
{0x82, 0xb7}, /* す */
|
||||
{0x82, 0xb8},
|
||||
{0x82, 0xb9}, /* せ */
|
||||
{0x82, 0xba},
|
||||
{0x82, 0xbf}, /* そ */
|
||||
{0x82, 0xbc},
|
||||
{0x82, 0xbd}, /* た */
|
||||
{0x82, 0xbe},
|
||||
{0x82, 0xbf}, /* ち */
|
||||
{0x82, 0xc0},
|
||||
{0x82, 0xc1}, /* っ */
|
||||
{0x82, 0xc2}, /* つ */
|
||||
{0x82, 0xc3},
|
||||
{0x82, 0xc4}, /* て */
|
||||
{0x82, 0xc5},
|
||||
{0x82, 0xc6}, /* と */
|
||||
{0x82, 0xc7},
|
||||
{0x82, 0xc8}, /* な */
|
||||
{0x82, 0xc9}, /* に */
|
||||
{0x82, 0xca}, /* ぬ */
|
||||
{0x82, 0xcb}, /* ね */
|
||||
{0x82, 0xcc}, /* の */
|
||||
{0x82, 0xcd}, /* は */
|
||||
{0x82, 0xce},
|
||||
{0x82, 0xcf},
|
||||
{0x82, 0xd0}, /* ひ */
|
||||
{0x82, 0xd1},
|
||||
{0x82, 0xd2},
|
||||
{0x82, 0xd3}, /* ふ */
|
||||
{0x82, 0xd4},
|
||||
{0x82, 0xd5},
|
||||
{0x82, 0xd6}, /* へ */
|
||||
{0x82, 0xd7},
|
||||
{0x82, 0xd8},
|
||||
{0x82, 0xd9}, /* ほ */
|
||||
{0x82, 0xda},
|
||||
{0x82, 0xdb},
|
||||
{0x82, 0xdc}, /* ま */
|
||||
{0x82, 0xdd}, /* み */
|
||||
{0x82, 0xde}, /* む */
|
||||
{0x82, 0xdf}, /* め */
|
||||
{0x82, 0xe0}, /* も */
|
||||
{0x82, 0xe1}, /* ゃ */
|
||||
{0x82, 0xe2}, /* や */
|
||||
{0x82, 0xe3}, /* ゅ */
|
||||
{0x82, 0xe4}, /* ゆ */
|
||||
{0x82, 0xe5}, /* ょ */
|
||||
{0x82, 0xe6}, /* よ */
|
||||
{0x82, 0xe7}, /* ら */
|
||||
{0x82, 0xe8}, /* り */
|
||||
{0x82, 0xe9}, /* る */
|
||||
{0x82, 0xea}, /* れ */
|
||||
{0x82, 0xeb}, /* ろ */
|
||||
{0x82, 0xec},
|
||||
{0x82, 0xed}, /* わ */
|
||||
{0x82, 0xee},
|
||||
{0x82, 0xef},
|
||||
{0x82, 0xf0}, /* を */
|
||||
{0x82, 0xf1}, /* ん */
|
||||
{0x82, 0xf2},
|
||||
{0x82, 0xf3},
|
||||
{0x82, 0xf4},
|
||||
{0x82, 0xf5},
|
||||
{0x82, 0xf6},
|
||||
{0x82, 0xf7},
|
||||
{0x82, 0xf8},
|
||||
{0x82, 0xf9},
|
||||
{0x82, 0xfa},
|
||||
{0x82, 0xfb},
|
||||
{0x82, 0xfc},
|
||||
{0x82, 0xfd},
|
||||
{0x82, 0xfe},
|
||||
{0x82, 0xff}
|
||||
},{
|
||||
{0x00, 0xa7}, /* ぁ */
|
||||
{0x00, 0xb1}, /* あ */
|
||||
{0x00, 0xa8}, /* ぃ */
|
||||
{0x00, 0xb2}, /* い */
|
||||
{0x00, 0xa9}, /* ぅ */
|
||||
{0x00, 0xb3}, /* う */
|
||||
{0x00, 0xaa}, /* ぇ */
|
||||
{0x00, 0xb4}, /* え */
|
||||
{0x00, 0xab}, /* ぉ */
|
||||
{0x00, 0xb5}, /* お */
|
||||
{0x00, 0xb6}, /* か */
|
||||
{0x83, 0x4b},
|
||||
{0x00, 0xb7}, /* き */
|
||||
{0x83, 0x4d},
|
||||
{0x00, 0xb8}, /* く */
|
||||
{0x83, 0x4f},
|
||||
{0x00, 0xb9}, /* け */
|
||||
{0x83, 0x51},
|
||||
{0x00, 0xba}, /* こ */
|
||||
{0x83, 0x53},
|
||||
{0x00, 0xbb}, /* さ */
|
||||
{0x83, 0x55},
|
||||
{0x00, 0xbc}, /* し */
|
||||
{0x83, 0x57},
|
||||
{0x00, 0xbd}, /* す */
|
||||
{0x83, 0x59},
|
||||
{0x00, 0xbe}, /* せ */
|
||||
{0x83, 0x5b},
|
||||
{0x00, 0xbf}, /* そ */
|
||||
{0x83, 0x5d},
|
||||
{0x00, 0xc0}, /* た */
|
||||
{0x83, 0x5f},
|
||||
{0x00, 0xc1}, /* ち */
|
||||
{0x83, 0x61},
|
||||
{0x00, 0xaf}, /* っ */
|
||||
{0x00, 0xc2}, /* つ */
|
||||
{0x83, 0x64},
|
||||
{0x00, 0xc3}, /* て */
|
||||
{0x83, 0x66},
|
||||
{0x00, 0xc4}, /* と */
|
||||
{0x83, 0x68},
|
||||
{0x00, 0xc5}, /* な */
|
||||
{0x00, 0xc6}, /* に */
|
||||
{0x00, 0xc7}, /* ぬ */
|
||||
{0x00, 0xc8}, /* ね */
|
||||
{0x00, 0xc9}, /* の */
|
||||
{0x00, 0xca}, /* は */
|
||||
{0x83, 0x6f},
|
||||
{0x83, 0x70},
|
||||
{0x00, 0xcb}, /* ひ */
|
||||
{0x83, 0x72},
|
||||
{0x83, 0x73},
|
||||
{0x00, 0xcc}, /* ふ */
|
||||
{0x83, 0x75},
|
||||
{0x83, 0x76},
|
||||
{0x00, 0xcd}, /* へ */
|
||||
{0x83, 0x78},
|
||||
{0x83, 0x79},
|
||||
{0x00, 0xce}, /* ほ */
|
||||
{0x83, 0x7b},
|
||||
{0x83, 0x7c},
|
||||
{0x00, 0xcf}, /* ま */
|
||||
{0x00, 0xd0}, /* み */
|
||||
{0x83, 0x7f},
|
||||
{0x00, 0xd1}, /* む */
|
||||
{0x00, 0xd2}, /* め */
|
||||
{0x00, 0xd3}, /* も */
|
||||
{0x00, 0xac}, /* ゃ */
|
||||
{0x00, 0xd4}, /* や */
|
||||
{0x00, 0xad}, /* ゅ */
|
||||
{0x00, 0xd5}, /* ゆ */
|
||||
{0x00, 0xae}, /* ょ */
|
||||
{0x00, 0xd6}, /* よ */
|
||||
{0x00, 0xd7}, /* ら */
|
||||
{0x00, 0xd8}, /* り */
|
||||
{0x00, 0xd9}, /* る */
|
||||
{0x00, 0xda}, /* れ */
|
||||
{0x00, 0xdb}, /* ろ */
|
||||
{0x83, 0x8e},
|
||||
{0x00, 0xdc}, /* わ */
|
||||
{0x83, 0x90},
|
||||
{0x83, 0x91},
|
||||
{0x00, 0xa6}, /* を */
|
||||
{0x00, 0xdd}, /* ん */
|
||||
{0x83, 0x94},
|
||||
{0x83, 0x95},
|
||||
{0x83, 0x96},
|
||||
{0x83, 0x97},
|
||||
{0x83, 0x98},
|
||||
{0x83, 0x99},
|
||||
{0x83, 0x9a},
|
||||
{0x83, 0x9b},
|
||||
{0x83, 0x9c},
|
||||
{0x83, 0x9d},
|
||||
{0x83, 0x9e},
|
||||
{0x83, 0x9f},
|
||||
{0x83, 0xa0},
|
||||
{0x83, 0xa1},
|
||||
{0x83, 0xa2},
|
||||
{0x83, 0xa3},
|
||||
{0x83, 0xa4},
|
||||
{0x83, 0xa5},
|
||||
{0x83, 0xa6},
|
||||
{0x83, 0xa7},
|
||||
{0x83, 0xa8},
|
||||
{0x83, 0xa9},
|
||||
{0x83, 0xaa},
|
||||
{0x83, 0xab},
|
||||
{0x83, 0xac},
|
||||
{0x83, 0xad},
|
||||
{0x83, 0xae},
|
||||
{0x83, 0xaf},
|
||||
{0x83, 0xb0},
|
||||
{0x83, 0xb1},
|
||||
{0x83, 0xb2},
|
||||
{0x83, 0xb3},
|
||||
{0x83, 0xb4},
|
||||
{0x83, 0xb5},
|
||||
{0x83, 0xb6},
|
||||
{0x83, 0xb7},
|
||||
{0x83, 0xb8},
|
||||
{0x83, 0xb9},
|
||||
{0x83, 0xba},
|
||||
{0x83, 0xbb},
|
||||
{0x83, 0xbc},
|
||||
{0x83, 0xbd},
|
||||
{0x83, 0xbe},
|
||||
{0x83, 0xbf},
|
||||
{0x83, 0xc0},
|
||||
{0x83, 0xc1},
|
||||
{0x83, 0xc2},
|
||||
{0x83, 0xc3},
|
||||
{0x83, 0xc4},
|
||||
{0x83, 0xc5},
|
||||
{0x83, 0xc6},
|
||||
{0x83, 0xc7},
|
||||
{0x83, 0xc8},
|
||||
{0x83, 0xc9},
|
||||
{0x83, 0xca},
|
||||
{0x83, 0xcb},
|
||||
{0x83, 0xcc},
|
||||
{0x83, 0xcd},
|
||||
{0x83, 0xce},
|
||||
{0x83, 0xcf},
|
||||
{0x83, 0xd0},
|
||||
{0x83, 0xd1},
|
||||
{0x83, 0xd2},
|
||||
{0x83, 0xd3},
|
||||
{0x83, 0xd4},
|
||||
{0x83, 0xd5},
|
||||
{0x83, 0xd6},
|
||||
{0x83, 0xd7},
|
||||
{0x83, 0xd8},
|
||||
{0x83, 0xd9},
|
||||
{0x83, 0xda},
|
||||
{0x83, 0xdb},
|
||||
{0x83, 0xdc},
|
||||
{0x83, 0xdd},
|
||||
{0x83, 0xde},
|
||||
{0x83, 0xdf},
|
||||
{0x83, 0xe0},
|
||||
{0x83, 0xe1},
|
||||
{0x83, 0xe2},
|
||||
{0x83, 0xe3},
|
||||
{0x83, 0xe4},
|
||||
{0x83, 0xe5},
|
||||
{0x83, 0xe6},
|
||||
{0x83, 0xe7},
|
||||
{0x83, 0xe8},
|
||||
{0x83, 0xe9},
|
||||
{0x83, 0xea},
|
||||
{0x83, 0xeb},
|
||||
{0x83, 0xec},
|
||||
{0x83, 0xed},
|
||||
{0x83, 0xee},
|
||||
{0x83, 0xef},
|
||||
{0x83, 0xf0},
|
||||
{0x83, 0xf1},
|
||||
{0x83, 0xf2},
|
||||
{0x83, 0xf3},
|
||||
{0x83, 0xf4},
|
||||
{0x83, 0xf5},
|
||||
{0x83, 0xf6},
|
||||
{0x83, 0xf7},
|
||||
{0x83, 0xf8},
|
||||
{0x83, 0xf9},
|
||||
{0x83, 0xfa},
|
||||
{0x83, 0xfb},
|
||||
{0x83, 0xfc},
|
||||
{0x83, 0xfd},
|
||||
{0x83, 0xfe},
|
||||
{0x83, 0xff}
|
||||
static const BYTE hankakutable[3][192] = {{
|
||||
// 0x8140 - 0x81ff
|
||||
' ', 0xa4, 0xa1, ',', '.', 0xa5, ':', ';',
|
||||
'?', '!', 0xde, 0xdf, 0, '`', 0, '^',
|
||||
'~', '_', 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0xb0, 0, 0, '/', 0,
|
||||
0, 0, '|', 0, 0, 0, '\'', 0,
|
||||
'"', '(', ')', 0, 0, '[', ']', '{',
|
||||
'}', 0, 0, 0, 0, 0xa2, 0xa3, 0,
|
||||
0, 0, 0, '+', '-', 0, 0, 0,
|
||||
0, '=', 0, '<', '>', 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, '\\',
|
||||
'$', 0, 0, '%', '#', '&', '*', '@',
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},{ // 0x8240 - 0x82ff
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, '0',
|
||||
'1', '2', '3', '4', '5', '6', '7', '8',
|
||||
'9', 0, 0, 0, 0, 0, 0, 0,
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
||||
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
||||
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
||||
'Y', 'Z', 0, 0, 0, 0, 0, 0,
|
||||
0, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
|
||||
'x', 'y', 'z', 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},{ // 0x8340 - 0x83ff
|
||||
0xa7, 0xb1, 0xa8, 0xb2, 0xa9, 0xb3, 0xaa, 0xb4,
|
||||
0xab, 0xb5, 0xb6, 0, 0xb7, 0, 0xb8, 0,
|
||||
0xb9, 0, 0xba, 0, 0xbb, 0, 0xbc, 0,
|
||||
0xbd, 0, 0xbe, 0, 0xbf, 0, 0xc0, 0,
|
||||
0xc1, 0, 0xaf, 0xc2, 0, 0xc3, 0, 0xc4,
|
||||
0, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0,
|
||||
0, 0xcb, 0, 0, 0xcc, 0, 0, 0xcd,
|
||||
0, 0, 0xce, 0, 0, 0xcf, 0xd0, 0,
|
||||
0xd1, 0xd2, 0xd3, 0xac, 0xd4, 0xad, 0xd5, 0xae,
|
||||
0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0, 0xdc,
|
||||
0, 0, 0xa6, 0xdd, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
}};
|
||||
|
||||
BYTE *zen2han(BYTE *src) {
|
||||
static const BYTE kanatbl[][2] = {
|
||||
0x81, 0x40, 0x81, 0x42, 0x81, 0x75, 0x81, 0x76,
|
||||
0x81, 0x41, 0x81, 0x45, 0x82, 0xf0, 0x82, 0x9f,
|
||||
0x82, 0xa1, 0x82, 0xa3, 0x82, 0xa5, 0x82, 0xa7,
|
||||
0x82, 0xe1, 0x82, 0xe3, 0x82, 0xe5, 0x82, 0xc1,
|
||||
0x81, 0x5b, 0x82, 0xa0, 0x82, 0xa2, 0x82, 0xa4,
|
||||
0x82, 0xa6, 0x82, 0xa8, 0x82, 0xa9, 0x82, 0xab,
|
||||
0x82, 0xad, 0x82, 0xaf, 0x82, 0xb1, 0x82, 0xb3,
|
||||
0x82, 0xb5, 0x82, 0xb7, 0x82, 0xb9, 0x82, 0xbb,
|
||||
0x82, 0xbd, 0x82, 0xbf, 0x82, 0xc2, 0x82, 0xc4,
|
||||
0x82, 0xc6, 0x82, 0xc8, 0x82, 0xc9, 0x82, 0xca,
|
||||
0x82, 0xcb, 0x82, 0xcc, 0x82, 0xcd, 0x82, 0xd0,
|
||||
0x82, 0xd3, 0x82, 0xd6, 0x82, 0xd9, 0x82, 0xdc,
|
||||
0x82, 0xdd, 0x82, 0xde, 0x82, 0xdf, 0x82, 0xe0,
|
||||
0x82, 0xe2, 0x82, 0xe4, 0x82, 0xe6, 0x82, 0xe7,
|
||||
0x82, 0xe8, 0x82, 0xe9, 0x82, 0xea, 0x82, 0xeb,
|
||||
0x82, 0xed, 0x82, 0xf1, 0x81, 0x4a, 0x81, 0x4b
|
||||
};
|
||||
|
||||
static const char zenkaku_digits[][3] = {
|
||||
0x82,0x4f,0x00, /* 0 */
|
||||
0x82,0x50,0x00, /* 1 */
|
||||
0x82,0x51,0x00, /* 2 */
|
||||
0x82,0x52,0x00, /* 3 */
|
||||
0x82,0x53,0x00, /* 4 */
|
||||
0x82,0x54,0x00, /* 5 */
|
||||
0x82,0x55,0x00, /* 6 */
|
||||
0x82,0x56,0x00, /* 7 */
|
||||
0x82,0x57,0x00, /* 8 */
|
||||
0x82,0x58,0x00, /* 9 */
|
||||
0x81,0x40,0x00, /* space */
|
||||
};
|
||||
|
||||
BYTE *zen2han(const BYTE *src) {
|
||||
BYTE c0, c1;
|
||||
char *dst, *_dst;
|
||||
|
||||
@@ -627,8 +155,9 @@ BYTE *zen2han(BYTE *src) {
|
||||
*dst++ = c0;
|
||||
} else if (c0 <= 0x83) {
|
||||
c1 = *src++;
|
||||
if (hankakutable[c0 - 0x81][c1 - 0x40][0] == 0) {
|
||||
*dst++ = hankakutable[c0 - 0x81][c1 - 0x40][1];
|
||||
BYTE h = hankakutable[c0 - 0x81][c1 - 0x40];
|
||||
if (h) {
|
||||
*dst++ = h;
|
||||
} else {
|
||||
*dst++ = c0; *dst++ = c1;
|
||||
}
|
||||
@@ -640,14 +169,13 @@ BYTE *zen2han(BYTE *src) {
|
||||
*dst++ = c0; *dst++ = *src++;
|
||||
}
|
||||
}
|
||||
*dst = 0;
|
||||
*dst = 0;
|
||||
return _dst;
|
||||
}
|
||||
|
||||
BYTE *han2zen(BYTE *src) {
|
||||
BYTE *han2zen(const BYTE *src) {
|
||||
BYTE c0;
|
||||
BYTE *dst, *_dst;
|
||||
BYTE *kindex;
|
||||
dst = _dst = malloc(strlen(src) * 2 + 1);
|
||||
|
||||
if (dst == NULL) {
|
||||
@@ -663,12 +191,33 @@ BYTE *han2zen(BYTE *src) {
|
||||
} else if (c0 >= 0xe0) {
|
||||
*dst++ = (char)c0; *dst++ = *src++;
|
||||
} else if (c0 >= 0xa0) {
|
||||
kindex = hankana2sjis(c0);
|
||||
const BYTE *kindex = kanatbl[c0 - 0xa0];
|
||||
*dst++ = *kindex; *dst++ = *(kindex+1);
|
||||
} else {
|
||||
*dst++ = (char)c0; *dst++ = *src++;
|
||||
}
|
||||
}
|
||||
*dst = 0;
|
||||
*dst = 0;
|
||||
return _dst;
|
||||
}
|
||||
|
||||
char *format_number(int n, int width, char *buf) {
|
||||
if (width) {
|
||||
sprintf(buf, "%*d", width, n);
|
||||
return buf + strlen(buf) - width;
|
||||
}
|
||||
sprintf(buf, "%d", n);
|
||||
return buf;
|
||||
}
|
||||
|
||||
char *format_number_zenkaku(int n, int width, char *buf) {
|
||||
char work[256];
|
||||
char *dst = buf;
|
||||
for (char *s = format_number(n, width, work); *s; s++) {
|
||||
const char *p = zenkaku_digits[*s == ' ' ? 10 : *s - '0'];
|
||||
while (*p)
|
||||
*dst++ = *p++;
|
||||
}
|
||||
*dst = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* hankaku.c zenkaku<->hankaku conversion
|
||||
*
|
||||
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
|
||||
* 1998- <masaki-c@is.aist-nara.ac.jp>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __HANKAKU_H__
|
||||
#define __HANKAKU_H__
|
||||
|
||||
#include "portab.h"
|
||||
|
||||
extern BYTE *zen2han(const BYTE *src);
|
||||
extern BYTE *han2zen(const BYTE *src);
|
||||
extern char *format_number(int n, int width, char *buf);
|
||||
extern char *format_number_zenkaku(int n, int width, char *buf);
|
||||
|
||||
#endif /* __HANKAKU_H__ */
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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 "hankaku.h"
|
||||
#include "utfsjis.h"
|
||||
#include "unittest.h"
|
||||
|
||||
typedef struct {
|
||||
const char *zen;
|
||||
const char *han;
|
||||
} Zen2hanTestCase;
|
||||
|
||||
static void zen2han_test(void) {
|
||||
const Zen2hanTestCase testcases[] = {
|
||||
{"", ""},
|
||||
{" ", " "},
|
||||
{"、。,.", "、。,."},
|
||||
{"・:;?!", "・:;?!"},
|
||||
{"゛゜`^", "゙゚`^"},
|
||||
{" ̄_ー/|", "~_ー/|"},
|
||||
{"’”", "'\""},
|
||||
{"()[]{}「」", "()[]{}「」"},
|
||||
{"+-=<>¥$%#&*@", "+-=<>\\$%#&*@"},
|
||||
{"0123456789", "0123456789"},
|
||||
{"ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"},
|
||||
{"abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz"},
|
||||
{"ァアィイゥウェエォオカキクケコサシスセソタチッツテトナニヌネノハヒフヘホマミムメモャヤュユョヨラリルレロワヲン", "ァアィイゥウェエォオカキクケコサシスセソタチッツテトナニヌネノハヒフヘホマミムメモャヤュユョヨラリルレロワヲン"},
|
||||
{NULL, NULL},
|
||||
};
|
||||
const char unconvertable[] =
|
||||
"´¨ヽヾゝゞ〃仝々〆〇―‐\~∥…‥‘“〔〕〈〉《》『』【】±×÷≠≦≧"
|
||||
"∞∴♂♀°′″℃¢£§☆★○●◎◇◆□■△▲▽▼※〒→←↑↓〓∈∋⊆⊇"
|
||||
"⊂⊃∪∩∧∨¬⇒⇔∀∃∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬ʼn♯♭♪†‡¶◯"
|
||||
"ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっ"
|
||||
"つづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆ"
|
||||
"ょよらりるれろゎわゐゑをんゔガギグゲゴザジズゼゾダヂヅデドバパビピブプ"
|
||||
"ベペボポヮヰヱヴヵヶΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩα"
|
||||
"βγδεζηθικλμνξοπρστυφχψω";
|
||||
for (const Zen2hanTestCase *tc = testcases; tc->zen; tc++) {
|
||||
ASSERT_STRCMP(sjis2utf(zen2han(utf2sjis(tc->zen))), tc->han);
|
||||
}
|
||||
ASSERT_STRCMP(sjis2utf(zen2han(utf2sjis(unconvertable))), unconvertable);
|
||||
}
|
||||
|
||||
static void format_number_test(void) {
|
||||
char buf[256];
|
||||
ASSERT_STRCMP(format_number(0, 0, buf), "0");
|
||||
ASSERT_STRCMP(format_number(42, 0, buf), "42");
|
||||
ASSERT_STRCMP(format_number(0, 3, buf), " 0");
|
||||
ASSERT_STRCMP(format_number(42, 3, buf), " 42");
|
||||
ASSERT_STRCMP(format_number(65535, 3, buf), "535");
|
||||
}
|
||||
|
||||
static void format_number_zenkaku_test(void) {
|
||||
char buf[512];
|
||||
ASSERT_STRCMP(sjis2utf(format_number_zenkaku(0, 0, buf)), "0");
|
||||
ASSERT_STRCMP(sjis2utf(format_number_zenkaku(42, 0, buf)), "42");
|
||||
ASSERT_STRCMP(sjis2utf(format_number_zenkaku(0, 3, buf)), " 0");
|
||||
ASSERT_STRCMP(sjis2utf(format_number_zenkaku(42, 3, buf)), " 42");
|
||||
ASSERT_STRCMP(sjis2utf(format_number_zenkaku(65535, 3, buf)), "535");
|
||||
}
|
||||
|
||||
void hankaku_test(void) {
|
||||
zen2han_test();
|
||||
format_number_test();
|
||||
format_number_zenkaku_test();
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* hankana2sjis.c 半角カタカナ -> 全角平仮名変換
|
||||
*
|
||||
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
|
||||
* 1998- <masaki-c@is.aist-nara.ac.jp>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
/* $Id: hankana2sjis.c,v 1.4 2000/11/25 13:09:06 chikama Exp $ */
|
||||
|
||||
// index = 0xa0~
|
||||
char *hankana2sjis(int index) {
|
||||
static char kanatbl[][2] = {
|
||||
0x81, 0x40, 0x81, 0x42, 0x81, 0x75, 0x81, 0x76,
|
||||
0x81, 0x41, 0x81, 0x45, 0x82, 0xf0, 0x82, 0x9f,
|
||||
0x82, 0xa1, 0x82, 0xa3, 0x82, 0xa5, 0x82, 0xa7,
|
||||
0x82, 0xe1, 0x82, 0xe3, 0x82, 0xe5, 0x82, 0xc1,
|
||||
0x81, 0x5b, 0x82, 0xa0, 0x82, 0xa2, 0x82, 0xa4,
|
||||
0x82, 0xa6, 0x82, 0xa8, 0x82, 0xa9, 0x82, 0xab,
|
||||
0x82, 0xad, 0x82, 0xaf, 0x82, 0xb1, 0x82, 0xb3,
|
||||
0x82, 0xb5, 0x82, 0xb7, 0x82, 0xb9, 0x82, 0xbb,
|
||||
0x82, 0xbd, 0x82, 0xbf, 0x82, 0xc2, 0x82, 0xc4,
|
||||
0x82, 0xc6, 0x82, 0xc8, 0x82, 0xc9, 0x82, 0xca,
|
||||
0x82, 0xcb, 0x82, 0xcc, 0x82, 0xcd, 0x82, 0xd0,
|
||||
0x82, 0xd3, 0x82, 0xd6, 0x82, 0xd9, 0x82, 0xdc,
|
||||
0x82, 0xdd, 0x82, 0xde, 0x82, 0xdf, 0x82, 0xe0,
|
||||
0x82, 0xe2, 0x82, 0xe4, 0x82, 0xe6, 0x82, 0xe7,
|
||||
0x82, 0xe8, 0x82, 0xe9, 0x82, 0xea, 0x82, 0xeb,
|
||||
0x82, 0xed, 0x82, 0xf1, 0x81, 0x4a, 0x81, 0x4b
|
||||
};
|
||||
return kanatbl[index - 0xa0];
|
||||
}
|
||||
|
||||
char *num2sjis(int num) {
|
||||
static char suji[][3] = {
|
||||
0x82,0x4f,0x00, /* 0 */
|
||||
0x82,0x50,0x00, /* 1 */
|
||||
0x82,0x51,0x00, /* 2 */
|
||||
0x82,0x52,0x00, /* 3 */
|
||||
0x82,0x53,0x00, /* 4 */
|
||||
0x82,0x54,0x00, /* 5 */
|
||||
0x82,0x55,0x00, /* 6 */
|
||||
0x82,0x56,0x00, /* 7 */
|
||||
0x82,0x57,0x00, /* 8 */
|
||||
0x82,0x58,0x00, /* 9 */
|
||||
0x81,0x40,0x00, /* space */
|
||||
};
|
||||
return suji[num];
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <jpeglib.h>
|
||||
#undef max
|
||||
#undef min
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "system.h"
|
||||
#include "ags.h"
|
||||
#include "jpeg.h"
|
||||
|
||||
boolean jpeg_checkfmt(BYTE *data) {
|
||||
return data[0] == 0xff && data[1] == 0xd8;
|
||||
}
|
||||
|
||||
cgdata *jpeg_extract(BYTE *data, size_t size) {
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
|
||||
// TODO: Error handling
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
jpeg_create_decompress(&cinfo);
|
||||
|
||||
jpeg_mem_src(&cinfo, data, size);
|
||||
if (jpeg_read_header(&cinfo, TRUE) != JPEG_HEADER_OK) {
|
||||
WARNING("jpeg_read_header failed\n");
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
jpeg_start_decompress(&cinfo);
|
||||
|
||||
cgdata *cg = calloc(1, sizeof(cgdata));
|
||||
cg->type = ALCG_JPEG;
|
||||
cg->width = cinfo.output_width;
|
||||
cg->height = cinfo.output_height;
|
||||
cg->pic = malloc(sizeof(WORD) * cg->width * cg->height);
|
||||
|
||||
int row_stride = cinfo.output_width * cinfo.output_components;
|
||||
JSAMPARRAY buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
|
||||
|
||||
WORD *dst = (WORD *)cg->pic;
|
||||
while (cinfo.output_scanline < cinfo.output_height) {
|
||||
jpeg_read_scanlines(&cinfo, buffer, 1);
|
||||
for (int x = 0; x < cinfo.output_width; x++)
|
||||
*dst++ = PIX16(buffer[0][x * 3], buffer[0][x * 3 + 1], buffer[0][x * 3 + 2]);
|
||||
}
|
||||
jpeg_finish_decompress(&cinfo);
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
|
||||
return cg;
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __JPEG_H__
|
||||
#define __JPEG_H__
|
||||
|
||||
#include "cg.h"
|
||||
|
||||
extern boolean jpeg_checkfmt(BYTE *data);
|
||||
extern cgdata *jpeg_extract(BYTE *data, size_t size);
|
||||
|
||||
#endif // __JPEG_H__
|
||||
+16
-7
@@ -58,7 +58,7 @@ static boolean nextLineIsAfterKaigyou = FALSE;
|
||||
|
||||
/* Private Methods */
|
||||
static void drawLineFrame(Bcom_WindowInfo *info);
|
||||
static void copyMsgToStrVar(char *m);
|
||||
static void copyMsgToStrVar(const char *m);
|
||||
static void msgget_at_r();
|
||||
static void msgget_at_a();
|
||||
|
||||
@@ -108,7 +108,7 @@ void msg_setStringDecorationType(int type) {
|
||||
msgDecorateType = type;
|
||||
}
|
||||
|
||||
void msg_putMessage(char *m) {
|
||||
void msg_putMessage(const char *m) {
|
||||
int w;
|
||||
MyRectangle adj;
|
||||
|
||||
@@ -130,6 +130,7 @@ void msg_putMessage(char *m) {
|
||||
ags_setFont(msg.MsgFont, msg.MsgFontSize);
|
||||
switch(msgDecorateType) {
|
||||
case 0:
|
||||
default:
|
||||
adj.x = 0; adj.y = 0; adj.width = 0; adj.height = 0;
|
||||
break;
|
||||
case 1:
|
||||
@@ -145,6 +146,12 @@ void msg_putMessage(char *m) {
|
||||
adj.x = 0; adj.y = 0; adj.width = 1; adj.height = 1;
|
||||
break;
|
||||
case 4:
|
||||
ags_drawString(msgcur.x -1, msgcur.y, m, msgDecorateColor);
|
||||
ags_drawString(msgcur.x +1, msgcur.y, m, msgDecorateColor);
|
||||
ags_drawString(msgcur.x, msgcur.y -1, m, msgDecorateColor);
|
||||
ags_drawString(msgcur.x, msgcur.y +1, m, msgDecorateColor);
|
||||
adj.x = -1; adj.y = -1; adj.width = 2; adj.height = 2;
|
||||
break;
|
||||
case 6:
|
||||
ags_drawString(msgcur.x +1, msgcur.y, m, msg.MsgFontColor);
|
||||
adj.x = 0; adj.y = 0; adj.width = 1; adj.height = 0;
|
||||
@@ -157,11 +164,13 @@ void msg_putMessage(char *m) {
|
||||
ags_drawString(msgcur.x +1, msgcur.y +1, m, msg.MsgFontColor);
|
||||
adj.x = 0; adj.y = 0; adj.width = 1; adj.height = 1;
|
||||
break;
|
||||
case 9:
|
||||
case 10:
|
||||
adj.x = 0; adj.y = 0; adj.width = 0; adj.height = 0;
|
||||
break;
|
||||
default:
|
||||
ags_drawString(msgcur.x -1, msgcur.y , m, msgDecorateColor);
|
||||
ags_drawString(msgcur.x +1, msgcur.y , m, msgDecorateColor);
|
||||
ags_drawString(msgcur.x , msgcur.y -1, m, msgDecorateColor);
|
||||
ags_drawString(msgcur.x , msgcur.y +1, m, msgDecorateColor);
|
||||
ags_drawString(msgcur.x +2, msgcur.y +2, m, msgDecorateColor);
|
||||
adj.x = -1; adj.y = -1; adj.width = 3; adj.height = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -339,7 +348,7 @@ static void drawLineFrame(Bcom_WindowInfo *i) {
|
||||
ags_updateArea(i->x -8, i->y -8, i->width +16, i->height +16);
|
||||
}
|
||||
|
||||
static void copyMsgToStrVar(char *m) {
|
||||
static void copyMsgToStrVar(const char *m) {
|
||||
if (v_strlen(msg.mg_curStrVarNo -1) == 0) {
|
||||
v_strcpy(msg.mg_curStrVarNo -1, m);
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ extern void msg_init();
|
||||
extern void msg_setFontSize(int size);
|
||||
extern void msg_setStringDecorationColor(int col);
|
||||
extern void msg_setStringDecorationType(int type);
|
||||
extern void msg_putMessage(char *msg);
|
||||
extern void msg_putMessage(const char *msg);
|
||||
extern void msg_nextLine();
|
||||
extern void msg_nextPage(boolean clear);
|
||||
extern void msg_hitAnyKey();
|
||||
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* 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 <stdlib.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#undef max
|
||||
#undef min
|
||||
#else // _WIN32
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_MMAP
|
||||
#include <sys/mman.h>
|
||||
#endif // HAVE_MMAP
|
||||
#endif // _WIN32
|
||||
#include "system.h"
|
||||
#include "mmap.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
mmap_t *map_file(const char *path) {
|
||||
HANDLE hFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
|
||||
if (!hFile)
|
||||
return NULL;
|
||||
HANDLE hMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
|
||||
if (!hMapping)
|
||||
return NULL;
|
||||
void *addr = MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0);
|
||||
if (addr == NULL)
|
||||
return NULL;
|
||||
CloseHandle(hMapping);
|
||||
CloseHandle(hFile);
|
||||
|
||||
mmap_t *m = malloc(sizeof(mmap_t));
|
||||
m->addr = addr;
|
||||
return m;
|
||||
}
|
||||
|
||||
int unmap_file(mmap_t *m) {
|
||||
UnmapViewOfFile(m->addr);
|
||||
free(m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else // _WIN32
|
||||
|
||||
mmap_t *map_file(const char *path) {
|
||||
int fd = open(path, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
WARNING("open: %s\n", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct stat sbuf;
|
||||
if (fstat(fd, &sbuf) < 0) {
|
||||
WARNING("fstat: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
void *addr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);
|
||||
if (addr == MAP_FAILED) {
|
||||
WARNING("mmap: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
void *addr = malloc(sbuf.st_size);
|
||||
if (!addr) {
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
size_t bytes = 0;
|
||||
while (bytes < sbuf.st_size) {
|
||||
ssize_t ret = read(fd, addr + bytes, sbuf.st_size - bytes);
|
||||
if (ret <= 0) {
|
||||
WARNING("read: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
free(addr);
|
||||
return NULL;
|
||||
}
|
||||
bytes += ret;
|
||||
}
|
||||
#endif
|
||||
close(fd);
|
||||
|
||||
mmap_t *m = malloc(sizeof(mmap_t));
|
||||
m->addr = addr;
|
||||
m->length = sbuf.st_size;
|
||||
return m;
|
||||
}
|
||||
|
||||
int unmap_file(mmap_t *m) {
|
||||
#ifdef HAVE_MMAP
|
||||
int rv = munmap(m->addr, m->length);
|
||||
free(m);
|
||||
return rv;
|
||||
#else
|
||||
free(m->addr);
|
||||
free(m);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _WIN32
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef __MMAP_H__
|
||||
#define __MMAP_H__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(HAVE_MMAP) || defined(_WIN32)
|
||||
#define HAVE_MEMORY_MAPPED_FILE
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
void *addr;
|
||||
#ifndef _WIN32
|
||||
size_t length;
|
||||
#endif
|
||||
} mmap_t;
|
||||
|
||||
mmap_t *map_file(const char *path);
|
||||
int unmap_file(mmap_t *m);
|
||||
|
||||
#endif /* __MMAP_H__ */
|
||||
+4
-30
@@ -38,6 +38,7 @@
|
||||
#include "message.h"
|
||||
#include "input.h"
|
||||
#include "menu.h"
|
||||
#include "hankaku.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -51,11 +52,6 @@ MG コマンド: 表示時の ZH に依存
|
||||
|
||||
*/
|
||||
|
||||
/* defined in hankaku.c */
|
||||
extern BYTE *zen2han(BYTE *src);
|
||||
extern BYTE *han2zen(BYTE *src);
|
||||
/* defined by hankan2sjis.c */
|
||||
extern char *hankana2sjis(int index);
|
||||
/* defined by cmd_check.c */
|
||||
extern void check_command(int c0);
|
||||
/* defined by cmdv.c */
|
||||
@@ -101,31 +97,9 @@ char *sys_getConstString() {
|
||||
return msgbuf;
|
||||
}
|
||||
|
||||
/* 加工済み(半カナ->全カナ) 文字列抽出 */
|
||||
char* sys_getConvString(char term) {
|
||||
int c0;
|
||||
char *index = msgbuf;
|
||||
char *kindex;
|
||||
|
||||
while ((c0 = sl_getc()) != (int)term) {
|
||||
if (c0 == 0x20) {
|
||||
*index++ = 0x81; *index++ = 0x40;
|
||||
} else if (c0 >= 0xe0) {
|
||||
*index++ = (char)c0; *index++ = (char)sl_getc();
|
||||
} else if (c0 >= 0xa0) {
|
||||
kindex = hankana2sjis(c0);
|
||||
*index++ = *kindex; *index++ = *(kindex+1);
|
||||
} else {
|
||||
*index++ = (char)c0; *index++ = (char)sl_getc();
|
||||
}
|
||||
}
|
||||
*index = 0;
|
||||
return msgbuf;
|
||||
}
|
||||
|
||||
/* 選択肢・通常メッセージ振り分け */
|
||||
void sys_addMsg(char *str) {
|
||||
char *msg = NULL;
|
||||
void sys_addMsg(const char *str) {
|
||||
const char *msg = NULL;
|
||||
|
||||
switch(msg_msgHankakuMode) {
|
||||
case 0:
|
||||
@@ -153,7 +127,7 @@ void sys_addMsg(char *str) {
|
||||
}
|
||||
|
||||
if (msg && msg_msgHankakuMode < 2) {
|
||||
free(msg);
|
||||
free((char *)msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-21
@@ -29,6 +29,7 @@
|
||||
#include "scenario.h"
|
||||
#include "font.h"
|
||||
#include "s39ain.h"
|
||||
#include "gameresource.h"
|
||||
#include "selection.h"
|
||||
#include "message.h"
|
||||
#include "ags.h"
|
||||
@@ -44,8 +45,7 @@ extern int getCaliValue();
|
||||
extern int *getCaliVariable();
|
||||
extern int *getVariable();
|
||||
extern char *sys_getString(char term);
|
||||
extern char *sys_getConvString(char term);
|
||||
extern void sys_addMsg(char *str);
|
||||
extern void sys_addMsg(const char *str);
|
||||
extern void sys_setHankakuMode(int mode);
|
||||
extern char *sys_getConstString();
|
||||
|
||||
@@ -63,7 +63,7 @@ typedef struct {
|
||||
boolean popupmenu_opened; /* popup menu が 開いているか */
|
||||
boolean mmx_is_ok; /* MMX が有効かどうか */
|
||||
|
||||
char game_title_name[31];
|
||||
char *game_title_utf8;
|
||||
int scenario_version;
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ typedef struct {
|
||||
/* メッセージ関連 */
|
||||
msg_t msg;
|
||||
boolean is_msg_out; /* 通常メッセージを表示するか */
|
||||
void (*msgout)(char *msg); // 通常以外(DLL等)のメッセージ表示関数
|
||||
void (*msgout)(const char *msg); // 通常以外(DLL等)のメッセージ表示関数
|
||||
|
||||
/* 選択肢関連 */
|
||||
sel_t sel;
|
||||
@@ -123,23 +123,8 @@ typedef struct {
|
||||
/* ain 関連 */
|
||||
S39AIN ain;
|
||||
|
||||
/* データのファイル名 */
|
||||
struct {
|
||||
char *scenario[2];
|
||||
char *graphics[2];
|
||||
char *wav[2];
|
||||
char *midi[2];
|
||||
char *data[2];
|
||||
char *resource[2];
|
||||
char *bgm[2];
|
||||
char *save[27];
|
||||
char *savedir;
|
||||
char *init;
|
||||
char *bgi;
|
||||
char *wai;
|
||||
char *sact01;
|
||||
char *alk[10];
|
||||
} files;
|
||||
/* data file names */
|
||||
GameResource files;
|
||||
|
||||
int frame_count;
|
||||
int cmd_count;
|
||||
|
||||
+17
-65
@@ -22,15 +22,10 @@
|
||||
/* $Id: music_pcm.c,v 1.16 2003/11/09 15:06:13 chikama Exp $ */
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <SDL_mixer.h>
|
||||
|
||||
#include "portab.h"
|
||||
@@ -43,9 +38,7 @@
|
||||
#include "counter.h"
|
||||
#include "nact.h"
|
||||
#include "LittleEndian.h"
|
||||
#ifdef HAVE_MMAP
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#include "mmap.h"
|
||||
|
||||
#define DEFAULT_AUDIO_BUFFER_SIZE 2048
|
||||
|
||||
@@ -69,10 +62,10 @@ static pcmobj_t *pcmobj[128 + 1];
|
||||
|
||||
static int unload(int slot);
|
||||
static int load_wai();
|
||||
static char *wai_mapadr;
|
||||
static mmap_t *wai_map;
|
||||
|
||||
// Volume mixer channel
|
||||
#define WAIMIXCH(no) LittleEndian_getDW(wai_mapadr, 36 + (no -1) * 4 * 3 + 8)
|
||||
#define WAIMIXCH(no) LittleEndian_getDW(wai_map->addr, 36 + (no -1) * 4 * 3 + 8)
|
||||
|
||||
/**
|
||||
* 指定の番号の .WAV|.OGG をロードする。
|
||||
@@ -166,7 +159,7 @@ int muspcm_load_no(int slot, int no) {
|
||||
}
|
||||
|
||||
// if has .wai file
|
||||
if (wai_mapadr) {
|
||||
if (wai_map) {
|
||||
int ch = WAIMIXCH(no);
|
||||
prv.vol_pcm_sub[slot] = ch < 0 ? 0: ch;
|
||||
} else {
|
||||
@@ -345,63 +338,22 @@ int muspcm_waitend(int slot) {
|
||||
}
|
||||
|
||||
static int load_wai() {
|
||||
struct stat sbuf;
|
||||
char *adr;
|
||||
int fd;
|
||||
if (wai_map) {
|
||||
unmap_file(wai_map);
|
||||
wai_map = NULL;
|
||||
}
|
||||
if (nact->files.wai == NULL)
|
||||
return NG;
|
||||
wai_map = map_file(nact->files.wai);
|
||||
if (!wai_map)
|
||||
return NG;
|
||||
|
||||
wai_mapadr = NULL;
|
||||
if (nact->files.wai == NULL) goto endwai;
|
||||
|
||||
if (0 > (fd = open(nact->files.wai, O_RDONLY))) {
|
||||
WARNING("open: %s\n", strerror(errno));
|
||||
goto endwai;
|
||||
}
|
||||
|
||||
if (0 > fstat(fd, &sbuf)) {
|
||||
WARNING("fstat:%s\n", strerror(errno));
|
||||
close(fd);
|
||||
goto endwai;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
if (MAP_FAILED == (adr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, fd, 0))) {
|
||||
WARNING("mmap: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
goto endwai;
|
||||
}
|
||||
#else
|
||||
adr = malloc(sbuf.st_size);
|
||||
if (!adr) {
|
||||
WARNING("load_wai: out of memory\n");
|
||||
close(fd);
|
||||
goto endwai;
|
||||
}
|
||||
size_t bytes = 0;
|
||||
while (bytes < sbuf.st_size) {
|
||||
ssize_t ret = read(fd, adr, sbuf.st_size);
|
||||
if (ret <= 0) {
|
||||
WARNING("load_wai: failed to read\n");
|
||||
close(fd);
|
||||
free(adr);
|
||||
goto endwai;
|
||||
}
|
||||
bytes += ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
char *adr = wai_map->addr;
|
||||
if (*adr != 'X' || *(adr+1) != 'I' || *(adr+2) != '2') {
|
||||
WARNING("not WAI file\n");
|
||||
#ifdef HAVE_MMAP
|
||||
munmap(adr, sbuf.st_size);
|
||||
#else
|
||||
free(adr);
|
||||
#endif
|
||||
close(fd);
|
||||
goto endwai;
|
||||
unmap_file(wai_map);
|
||||
wai_map = NULL;
|
||||
return NG;
|
||||
}
|
||||
|
||||
wai_mapadr = adr;
|
||||
|
||||
endwai:
|
||||
return OK;
|
||||
}
|
||||
|
||||
+6
-9
@@ -26,14 +26,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include <dmalloc.h>
|
||||
#endif
|
||||
|
||||
#define YES 1
|
||||
#define NO 0
|
||||
#define OK 0
|
||||
#define ERROR (-1)
|
||||
#define NG (-1)
|
||||
#define true 1
|
||||
#define false 0
|
||||
@@ -41,7 +34,7 @@
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#undef TRUE
|
||||
#define TRUE (!FALSE)
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#define min(x,y) ((x) < (y) ? (x) : (y))
|
||||
@@ -49,8 +42,12 @@
|
||||
|
||||
typedef unsigned char ___BYTE;
|
||||
typedef unsigned short ___WORD;
|
||||
#ifdef _WIN32
|
||||
typedef unsigned long ___DWORD;
|
||||
#else
|
||||
typedef unsigned int ___DWORD;
|
||||
typedef char ___boolean;
|
||||
#endif
|
||||
typedef _Bool ___boolean;
|
||||
|
||||
#ifndef BYTE
|
||||
#define BYTE ___BYTE
|
||||
|
||||
+39
-1
@@ -27,10 +27,20 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include "win/resources.h"
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#include "portab.h"
|
||||
#include "profile.h"
|
||||
|
||||
#define RC_NAME ".xsys35rc"
|
||||
#define RC_LINE_CHARS_MAX 256
|
||||
#define REGKEY_PROFILE XSYSTEM35_REGKEY "\\profile"
|
||||
|
||||
struct profile_kv {
|
||||
char *name;
|
||||
char *value;
|
||||
@@ -128,10 +138,38 @@ static int load_rc_file(const char *profile_path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
static void load_profile_from_registry(HKEY rootKey)
|
||||
{
|
||||
HKEY hKey;
|
||||
LSTATUS err = RegOpenKeyEx(rootKey, REGKEY_PROFILE, 0, KEY_QUERY_VALUE, &hKey);
|
||||
if (err != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
for (DWORD index = 0;; index++) {
|
||||
char name[64];
|
||||
BYTE value[RC_LINE_CHARS_MAX];
|
||||
DWORD name_size = sizeof(name);
|
||||
DWORD value_size = sizeof(value);
|
||||
DWORD type;
|
||||
err = RegEnumValue(hKey, index, name, &name_size, NULL, &type, value, &value_size);
|
||||
if (err != ERROR_SUCCESS)
|
||||
break;
|
||||
if (type != REG_SZ)
|
||||
continue;
|
||||
insert_profile(name, value);
|
||||
}
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
int load_profile(void)
|
||||
{
|
||||
char *home_dir;
|
||||
#ifdef _WIN32
|
||||
load_profile_from_registry(HKEY_LOCAL_MACHINE);
|
||||
load_profile_from_registry(HKEY_CURRENT_USER);
|
||||
#endif // _WIN32
|
||||
|
||||
char *home_dir;
|
||||
if ((home_dir = getenv("HOME"))) {
|
||||
char profile_path[PATH_MAX];
|
||||
sprintf(profile_path, "%s/%s", home_dir, RC_NAME);
|
||||
|
||||
@@ -25,11 +25,6 @@
|
||||
#ifndef __PROFILE_H__
|
||||
#define __PROFILE_H__
|
||||
|
||||
#define RC_NAME ".xsys35rc"
|
||||
|
||||
/* 一行は 256 文字を越えない */
|
||||
#define RC_LINE_CHARS_MAX 256
|
||||
|
||||
int load_profile(void);
|
||||
char *get_profile(const char *name);
|
||||
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@
|
||||
#define dll nact->ain.dll
|
||||
#define msg nact->ain.msg
|
||||
#define fnc nact->ain.fnc
|
||||
#define path_to_ain nact->ain.path_to_ain
|
||||
#define path_to_ain nact->files.ain
|
||||
#define dllnum nact->ain.dllnum
|
||||
#define fncnum nact->ain.fncnum
|
||||
#define varnum nact->ain.varnum
|
||||
|
||||
@@ -50,8 +50,6 @@ typedef struct {
|
||||
|
||||
/* System39.ain 全体の情報 */
|
||||
typedef struct {
|
||||
char *path_to_ain; /* system39.ain へのパス */
|
||||
|
||||
int dllnum; /* DLL の数 */
|
||||
int fncnum; /* FUNC の数 */
|
||||
int varnum; /* VARI の数 */
|
||||
|
||||
+3
-3
@@ -64,7 +64,7 @@ int s39ini_init(void) {
|
||||
if (s1[0] == '\0') continue;
|
||||
if (i >= MAXVOLCH || i < 0) continue;
|
||||
s1[strlen(s1)-1] = '\0'; // remove last '"'
|
||||
vval[i].label = sjis2lang(s1);
|
||||
vval[i].label = sjis2utf(s1);
|
||||
vval_max = max(vval_max, i);
|
||||
//WARNING("VolumeValancer[%d] = %s\n", i, vval[i].label);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ int s39ini_init(void) {
|
||||
if (vval_max <= 0) return NG;
|
||||
|
||||
// Volume.sav があればそれを読み込む
|
||||
snprintf(fn, sizeof(fn) -1, "%s/Volume.sav", nact->files.savedir);
|
||||
snprintf(fn, sizeof(fn) -1, "%s/Volume.sav", nact->files.save_path);
|
||||
if (NULL == (fp = fopen(fn, "rb"))) {
|
||||
// とりあえず、初期ボリュームは 100
|
||||
for (i = 0; i < MAXVOLCH; i++) {
|
||||
@@ -142,7 +142,7 @@ int s39ini_remove() {
|
||||
vol[i] = vval[i].vol;
|
||||
}
|
||||
|
||||
snprintf(fn, sizeof(fn) -1, "%s/Volume.sav", nact->files.savedir);
|
||||
snprintf(fn, sizeof(fn) -1, "%s/Volume.sav", nact->files.save_path);
|
||||
if (NULL == (fp = fopen(fn, "wb"))) {
|
||||
WARNING("Fail to save Volume.save\n");
|
||||
return NG;
|
||||
|
||||
+35
-48
@@ -36,14 +36,12 @@
|
||||
#include "scenario.h"
|
||||
#include "xsystem35.h"
|
||||
#include "LittleEndian.h"
|
||||
#include "utfsjis.h"
|
||||
#include "filecheck.h"
|
||||
#include "windowframe.h"
|
||||
#include "selection.h"
|
||||
#include "message.h"
|
||||
|
||||
/* セーブデータ */
|
||||
static char *saveDataFile[SAVE_MAXNUMBER];
|
||||
static int savefile_sysvar_cnt = SYSVAR_MAX;
|
||||
|
||||
static void* saveStackInfo(Ald_stackHdr *head);
|
||||
@@ -63,25 +61,14 @@ EM_JS(void, scheduleSync, (), {
|
||||
#define scheduleSync()
|
||||
#endif
|
||||
|
||||
/* savefile がある directory を登録 */
|
||||
void save_set_path(char *path) {
|
||||
nact->files.savedir = strdup(path);
|
||||
fc_init(path);
|
||||
}
|
||||
|
||||
/* savefile を登録 */
|
||||
void save_register_file(char *name, int index) {
|
||||
saveDataFile[index] = strdup(name);
|
||||
}
|
||||
|
||||
/* savefile を参照 */
|
||||
char *save_get_file(int index) {
|
||||
return saveDataFile[index];
|
||||
const char *save_get_file(int index) {
|
||||
return nact->files.save_fname[index];
|
||||
}
|
||||
|
||||
/* savefile を削除 */
|
||||
int save_delete_file(int index) {
|
||||
int ret = unlink(saveDataFile[index]);
|
||||
int ret = unlink(nact->files.save_fname[index]);
|
||||
|
||||
if (ret == 0) {
|
||||
return 1;
|
||||
@@ -90,7 +77,7 @@ int save_delete_file(int index) {
|
||||
}
|
||||
|
||||
/* 指定ファイルへの変数の書き込み */
|
||||
int save_save_var_with_file(char *filename, int *start, int cnt) {
|
||||
int save_save_var_with_file(char *fname_utf8, int *start, int cnt) {
|
||||
int status = 0, size, i;
|
||||
FILE *fp;
|
||||
WORD *tmp, *_tmp;
|
||||
@@ -110,7 +97,7 @@ int save_save_var_with_file(char *filename, int *start, int cnt) {
|
||||
#endif
|
||||
}
|
||||
|
||||
if (NULL == (fp = fc_open(filename, 'w'))) {
|
||||
if (NULL == (fp = fc_open(fname_utf8, 'w'))) {
|
||||
status = SAVE_SAVEERR; goto errexit;
|
||||
}
|
||||
|
||||
@@ -131,7 +118,7 @@ int save_save_var_with_file(char *filename, int *start, int cnt) {
|
||||
}
|
||||
|
||||
/* 指定ファイルからの変数の読み込み */
|
||||
int save_load_var_with_file(char *filename, int *start, int cnt) {
|
||||
int save_load_var_with_file(char *fname_utf8, int *start, int cnt) {
|
||||
int status = 0, size, i;
|
||||
FILE *fp;
|
||||
WORD *tmp, *_tmp;
|
||||
@@ -143,7 +130,7 @@ int save_load_var_with_file(char *filename, int *start, int cnt) {
|
||||
return SAVE_LOADERR;
|
||||
}
|
||||
|
||||
if (NULL == (fp = fc_open(filename, 'r'))) {
|
||||
if (NULL == (fp = fc_open(fname_utf8, 'r'))) {
|
||||
status = SAVE_LOADERR; goto errexit;
|
||||
}
|
||||
|
||||
@@ -171,7 +158,7 @@ int save_load_var_with_file(char *filename, int *start, int cnt) {
|
||||
|
||||
|
||||
/* 指定ファイルへの文字列の書き込み, start = 1~ */
|
||||
int save_save_str_with_file(char *filename, int start, int cnt) {
|
||||
int save_save_str_with_file(char *fname_utf8, int start, int cnt) {
|
||||
int status = 0, size, _size,i;
|
||||
FILE *fp;
|
||||
char *tmp, *_tmp;
|
||||
@@ -185,11 +172,11 @@ int save_save_str_with_file(char *filename, int start, int cnt) {
|
||||
*tmp = 0;
|
||||
for (i = 0; i < cnt; i++) {
|
||||
strncpy(tmp, v_str(start + i - 1), strvar_len - 1);
|
||||
tmp += v_strlen(start + i - 1) + 1;
|
||||
tmp[strvar_len - 1] = '\0';
|
||||
tmp += strlen(tmp) + 1;
|
||||
}
|
||||
|
||||
|
||||
if (NULL == (fp = fc_open(filename, 'w'))) {
|
||||
if (NULL == (fp = fc_open(fname_utf8, 'w'))) {
|
||||
status = SAVE_SAVEERR; goto errexit;
|
||||
}
|
||||
size = tmp - _tmp;
|
||||
@@ -210,13 +197,13 @@ int save_save_str_with_file(char *filename, int start, int cnt) {
|
||||
}
|
||||
|
||||
/* 指定ファイルからの文字列の読み込み */
|
||||
int save_load_str_with_file(char *filename, int start, int cnt) {
|
||||
int save_load_str_with_file(char *fname_utf8, int start, int cnt) {
|
||||
int status = 0, size, i;
|
||||
FILE *fp;
|
||||
char *tmp, *_tmp=NULL;
|
||||
long filesize;
|
||||
|
||||
if (NULL == (fp = fc_open(filename, 'r'))) {
|
||||
if (NULL == (fp = fc_open(fname_utf8, 'r'))) {
|
||||
return SAVE_LOADERR;
|
||||
}
|
||||
|
||||
@@ -241,8 +228,8 @@ int save_load_str_with_file(char *filename, int start, int cnt) {
|
||||
status = SAVE_LOADOK;
|
||||
}
|
||||
for (i = 0; i < cnt; i++) {
|
||||
strncpy(v_str(start + i - 1), tmp, strvar_len);
|
||||
tmp += v_strlen(start + i - 1) + 1;
|
||||
v_strcpy(start + i - 1, tmp);
|
||||
tmp += strlen(tmp) + 1;
|
||||
}
|
||||
fclose(fp);
|
||||
free(_tmp);
|
||||
@@ -290,7 +277,7 @@ int save_loadPartial(int no, int page, int offset, int cnt) {
|
||||
cnt = min(cnt, SYSVAR_MAX - offset);
|
||||
var = sysVar + offset;
|
||||
} else {
|
||||
cnt = min(cnt, arrayVarBuffer[page - 1].max - offset);
|
||||
cnt = min(cnt, arrayVarBuffer[page - 1].size - offset);
|
||||
var = arrayVarBuffer[page - 1].value + offset;
|
||||
}
|
||||
|
||||
@@ -348,7 +335,7 @@ int save_savePartial(int no, int page, int offset, int cnt) {
|
||||
} else {
|
||||
if (arrayVarBuffer[page - 1].saveflag == FALSE)
|
||||
goto errexit;
|
||||
cnt = min(cnt, arrayVarBuffer[page - 1].max - offset);
|
||||
cnt = min(cnt, arrayVarBuffer[page - 1].size - offset);
|
||||
var = arrayVarBuffer[page - 1].value + offset;
|
||||
}
|
||||
|
||||
@@ -464,8 +451,8 @@ int save_saveAll(int no) {
|
||||
if (save_base == NULL)
|
||||
return SAVE_SAVEERR;
|
||||
|
||||
fc_backup_oldfile(saveDataFile[no]);
|
||||
fp = fopen(saveDataFile[no],"wb");
|
||||
fc_backup_oldfile(nact->files.save_fname[no]);
|
||||
fp = fopen(nact->files.save_fname[no], "wb");
|
||||
|
||||
if (fp == NULL)
|
||||
return SAVE_SAVEERR;
|
||||
@@ -599,7 +586,8 @@ static void *saveStrVar(Ald_strVarHdr *head) {
|
||||
*tmp = 0;
|
||||
for (i = 0; i < strvar_cnt; i++) {
|
||||
strncpy(tmp, v_str(i), strvar_len - 1);
|
||||
tmp += v_strlen(i) + 1;
|
||||
tmp[strvar_len - 1] = '\0';
|
||||
tmp += strlen(tmp) + 1;
|
||||
}
|
||||
head->size = tmp - _tmp;
|
||||
head->count = strvar_cnt;
|
||||
@@ -618,8 +606,8 @@ static void loadStrVar(char *buf) {
|
||||
v_initStringVars(cnt, max);
|
||||
buf += sizeof(Ald_strVarHdr);
|
||||
for (i = 0; i < cnt; i++) {
|
||||
strncpy(v_str(i), buf, max - 1);
|
||||
buf += v_strlen(i) + 1;
|
||||
v_strcpy(i, buf);
|
||||
buf += strlen(buf) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -634,7 +622,7 @@ static void *saveSysVar(Ald_sysVarHdr *head, int page) {
|
||||
} else if (!arrayVarBuffer[page - 1].saveflag) {
|
||||
return NULL;
|
||||
} else {
|
||||
cnt = arrayVarBuffer[page - 1].max;
|
||||
cnt = arrayVarBuffer[page - 1].size;
|
||||
var = arrayVarBuffer[page - 1].value;
|
||||
if (var == NULL)
|
||||
return NULL;
|
||||
@@ -672,7 +660,7 @@ static int loadSysVar(char *buf) {
|
||||
cnt = savefile_sysvar_cnt = head->size / sizeof(WORD);
|
||||
} else {
|
||||
cnt = head->size / sizeof(WORD);
|
||||
if (arrayVarBuffer[page - 1].max != cnt ||
|
||||
if (arrayVarBuffer[page - 1].size < cnt ||
|
||||
arrayVarBuffer[page - 1].value == NULL) {
|
||||
/*
|
||||
fprintf(stderr, "loadSysVar(): undef array\n");
|
||||
@@ -710,7 +698,7 @@ static void* loadGameData(int no, int *status, int *size) {
|
||||
long filesize;
|
||||
char *buf;
|
||||
|
||||
fp = fopen(saveDataFile[no], "rb");
|
||||
fp = fopen(nact->files.save_fname[no], "rb");
|
||||
if (fp == NULL)
|
||||
goto errexit;
|
||||
fseek(fp, 0L, SEEK_END);
|
||||
@@ -741,8 +729,8 @@ static int saveGameData(int no, char *buf, int size) {
|
||||
FILE *fp;
|
||||
int status = SAVE_SAVEOK1;
|
||||
|
||||
fc_backup_oldfile(saveDataFile[no]);
|
||||
fp = fopen(saveDataFile[no],"wb");
|
||||
fc_backup_oldfile(nact->files.save_fname[no]);
|
||||
fp = fopen(nact->files.save_fname[no], "wb");
|
||||
if (fp == NULL) {
|
||||
return SAVE_SAVEERR;
|
||||
}
|
||||
@@ -755,33 +743,32 @@ static int saveGameData(int no, char *buf, int size) {
|
||||
}
|
||||
|
||||
/* 指定ファイルからの画像の読み込み thanx tajiru@wizard */
|
||||
BYTE* load_cg_with_file(char *filename, int *status){
|
||||
BYTE* load_cg_with_file(char *fname_utf8, int *status, long *filesize){
|
||||
int size;
|
||||
FILE *fp;
|
||||
static BYTE *tmp;
|
||||
long filesize;
|
||||
|
||||
*status = 0;
|
||||
|
||||
if (NULL == (fp = fc_open(filename, 'r'))) {
|
||||
if (NULL == (fp = fc_open(fname_utf8, 'r'))) {
|
||||
*status = SAVE_LOADERR; return NULL;
|
||||
}
|
||||
|
||||
fseek(fp, 0L, SEEK_END);
|
||||
filesize = ftell(fp);
|
||||
if (filesize == 0) {
|
||||
*filesize = ftell(fp);
|
||||
if (*filesize == 0) {
|
||||
*status = SAVE_LOADERR; return NULL;
|
||||
}
|
||||
|
||||
tmp = (char *)malloc(filesize);
|
||||
tmp = (char *)malloc(*filesize);
|
||||
if (tmp == NULL) {
|
||||
WARNING("Out of memory\n");
|
||||
*status = SAVE_LOADERR; return NULL;
|
||||
}
|
||||
fseek(fp, 0L, SEEK_SET);
|
||||
size = fread(tmp, 1, filesize,fp);
|
||||
size = fread(tmp, 1, *filesize,fp);
|
||||
|
||||
if (size != filesize) {
|
||||
if (size != *filesize) {
|
||||
*status = SAVE_LOADSHORTAGE;
|
||||
} else {
|
||||
*status = SAVE_LOADOK;
|
||||
|
||||
+6
-8
@@ -120,14 +120,12 @@ extern int save_saveAll(int no);
|
||||
extern int save_loadPartial(int no, int page, int offset, int cnt);
|
||||
extern int save_savePartial(int no, int page, int offset, int cnt);
|
||||
extern int save_copyAll(int dstno, int srcno);
|
||||
extern int save_save_var_with_file(char *filename, int *start, int cnt);
|
||||
extern int save_load_var_with_file(char *filename, int *start, int cnt);
|
||||
extern int save_save_str_with_file(char *filename, int start, int cnt);
|
||||
extern int save_load_str_with_file(char *filename, int start, int cnt);
|
||||
extern BYTE* load_cg_with_file(char *file,int *status);
|
||||
extern void save_set_path(char *path);
|
||||
extern void save_register_file(char *name, int index);
|
||||
extern char* save_get_file(int index);
|
||||
extern int save_save_var_with_file(char *fname_utf8, int *start, int cnt);
|
||||
extern int save_load_var_with_file(char *fname_utf8, int *start, int cnt);
|
||||
extern int save_save_str_with_file(char *fname_utf8, int start, int cnt);
|
||||
extern int save_load_str_with_file(char *fname_utf8, int start, int cnt);
|
||||
extern BYTE* load_cg_with_file(char *fname_utf8, int *status, long *filesize);
|
||||
extern const char *save_get_file(int index);
|
||||
extern int save_delete_file(int index);
|
||||
|
||||
#endif /* __SAVEDATA__ */
|
||||
|
||||
+2
-3
@@ -53,7 +53,7 @@ extern void sdl_setPallet(Pallet256 *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, char *msg, unsigned long col);
|
||||
extern int sdl_drawString(int x, int y, const char *msg, 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);
|
||||
@@ -102,7 +102,6 @@ extern void sdl_mainIteration();
|
||||
extern boolean RawKeyInfo[];
|
||||
extern void sdl_sleep(int msec);
|
||||
extern void sdl_wait_vsync();
|
||||
extern void sdl_sync();
|
||||
|
||||
/* 初期化関係 */
|
||||
#define GraphicsInitilize() sdl_Initilize()
|
||||
@@ -116,7 +115,7 @@ extern void sdl_sync();
|
||||
#define GetDIB() sdl_getDIB()
|
||||
|
||||
/* 画面更新 */
|
||||
#define DspDeviceSync() sdl_sync()
|
||||
#define DspDeviceSync()
|
||||
#define UpdateArea(src,dst) sdl_updateArea((src),(dst))
|
||||
#define FullScreen(on) sdl_FullScreen(on)
|
||||
|
||||
|
||||
+12
-12
@@ -82,18 +82,18 @@ static SDL_Cursor *init_system_cursor(const char *image[]) {
|
||||
|
||||
/* mouse cursur の初期化 */
|
||||
void sdl_cursor_init(void) {
|
||||
cursor[IDC_ARROW] = init_system_cursor(cursor_arrow);
|
||||
cursor[IDC_CROSS] = init_system_cursor(cursor_cross);
|
||||
cursor[IDC_IBEAM] = init_system_cursor(cursor_ibeam);
|
||||
cursor[IDC_NO] = init_system_cursor(cursor_no);
|
||||
cursor[IDC_SIZE] = init_system_cursor(cursor_move);
|
||||
cursor[IDC_SIZEALL] = init_system_cursor(cursor_move);
|
||||
cursor[IDC_SIZENESW] = init_system_cursor(cursor_size_r);
|
||||
cursor[IDC_SIZENS] = init_system_cursor(cursor_size_v);
|
||||
cursor[IDC_SIZENWSE] = init_system_cursor(cursor_size_l);
|
||||
cursor[IDC_SIZEWE] = init_system_cursor(cursor_size_h);
|
||||
cursor[IDC_UPARROW] = init_system_cursor(cursor_uparrow);
|
||||
cursor[IDC_WAIT] = init_system_cursor(cursor_busy);
|
||||
cursor[CURSOR_ARROW] = init_system_cursor(cursor_arrow);
|
||||
cursor[CURSOR_CROSS] = init_system_cursor(cursor_cross);
|
||||
cursor[CURSOR_IBEAM] = init_system_cursor(cursor_ibeam);
|
||||
cursor[CURSOR_NO] = init_system_cursor(cursor_no);
|
||||
cursor[CURSOR_SIZE] = init_system_cursor(cursor_move);
|
||||
cursor[CURSOR_SIZEALL] = init_system_cursor(cursor_move);
|
||||
cursor[CURSOR_SIZENESW] = init_system_cursor(cursor_size_r);
|
||||
cursor[CURSOR_SIZENS] = init_system_cursor(cursor_size_v);
|
||||
cursor[CURSOR_SIZENWSE] = init_system_cursor(cursor_size_l);
|
||||
cursor[CURSOR_SIZEWE] = init_system_cursor(cursor_size_h);
|
||||
cursor[CURSOR_UPARROW] = init_system_cursor(cursor_uparrow);
|
||||
cursor[CURSOR_WAIT] = init_system_cursor(cursor_busy);
|
||||
}
|
||||
|
||||
boolean sdl_cursorNew(BYTE* data, int no, CursorImage *cursorImage, TCursorDirEntry *cursordirentry) {
|
||||
|
||||
+1
-1
@@ -412,7 +412,7 @@ static void sdl_drawAntiAlias_8bpp(int dstx, int dsty, agsurface_t *src, unsigne
|
||||
SDL_UnlockSurface(sdl_dib);
|
||||
}
|
||||
|
||||
int sdl_drawString(int x, int y, char *msg, unsigned long col) {
|
||||
int sdl_drawString(int x, int y, const char *msg, unsigned long col) {
|
||||
int w;
|
||||
|
||||
sdl_pal_check();
|
||||
|
||||
@@ -428,13 +428,3 @@ void sdl_restoreRegion(void *psrc, int x, int y) {
|
||||
sdl_putRegion(src, x ,y);
|
||||
SDL_FreeSurface(src);
|
||||
}
|
||||
|
||||
void sdl_sync() {
|
||||
// imageXX等でsurface内を直接操作する際に、本当はlock/unlockで
|
||||
// はさまないといけないんだけど、lockすればそれまでキューに入って
|
||||
// いた SDL内部の処理がすべて終ると予想されるのでXsyncと同様の
|
||||
// 効果があると思う。しかしUnlockしているので非同期でimageXXの処理中
|
||||
// にSDLの描画命令が入る可能性もあるが、X11ではたぶん大丈夫?
|
||||
SDL_LockSurface(sdl_dib);
|
||||
SDL_UnlockSurface(sdl_dib);
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ static void window_init(void) {
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
||||
SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight");
|
||||
Uint32 flags = SDL_WINDOW_FULLSCREEN;
|
||||
#else
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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 <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void gameresource_test(void);
|
||||
void hankaku_test(void);
|
||||
|
||||
void sys_error(char *format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main() {
|
||||
gameresource_test();
|
||||
hankaku_test();
|
||||
return 0;
|
||||
}
|
||||
+8
-18
@@ -26,20 +26,11 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef HAVE_FUNC
|
||||
#ifndef __GNUC__
|
||||
#define __func__ ""
|
||||
#else
|
||||
#define __func__ __FUNCTION__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* should define in somewhere */
|
||||
extern void sys_error(char *format, ...); /* show nessafe and exit system */
|
||||
extern void sys_exit(int code); /* exit system with code */
|
||||
extern void sys_message(char *format, ...); /* show various message */
|
||||
extern void sys_message(int lv, char *format, ...); /* show various message */
|
||||
extern void sys_reset();
|
||||
extern int sys_nextdebuglv; /* message level */
|
||||
|
||||
/*
|
||||
DEBUGLEVEL
|
||||
@@ -56,14 +47,13 @@ extern int sys_nextdebuglv; /* message level */
|
||||
#endif /* DEBUG */
|
||||
|
||||
#define NOMEMERR() sys_error("Out of memory at %s()\n", __func__)
|
||||
#define NOTICE sys_nextdebuglv = 2, sys_message
|
||||
#define NOTICE(...) sys_message(2, __VA_ARGS__)
|
||||
|
||||
#define WARNING sys_nextdebuglv = 1, \
|
||||
sys_message("*WARNING*(%s): ", __func__), sys_message
|
||||
|
||||
#define SYSERROR fprintf(stderr, "*ERROR*(%s): ", __func__), sys_error
|
||||
|
||||
#define SACT_DEBUG sys_nextdebuglv = 5, \
|
||||
sys_message("%s: ", __func__), sys_message
|
||||
#define SYSERROR(fmt, ...) \
|
||||
sys_error("*ERROR*(%s): " fmt, __func__, ##__VA_ARGS__)
|
||||
#define WARNING(fmt, ...) \
|
||||
sys_message(1, "*WARNING*(%s): " fmt, __func__, ##__VA_ARGS__)
|
||||
#define SACT_DEBUG(fmt, ...) \
|
||||
sys_message(5, "%s: " fmt, __func__, ##__VA_ARGS__)
|
||||
|
||||
#endif /* !__SYSTEM__ */
|
||||
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
# This line is a comment.
|
||||
|
||||
ScenarioA fooSA.ALD
|
||||
GraphicsA fooGA.ALD
|
||||
GraphicsB fooGB.ALD
|
||||
WaveA fooWA.ALD
|
||||
WaveZ fooWZ.ALD
|
||||
MidiC fooMC.ALD
|
||||
DataA file name with whitespaces
|
||||
ResourceA this line has whitespaces at end of line
|
||||
BGMA /path/to/fooBA.ALD
|
||||
|
||||
Ain System39.ain
|
||||
WAIA foo_WA.WAI
|
||||
BGIA foo_BA.BGI
|
||||
SACT01 SACTEFAM.KLD
|
||||
Init System39.ini
|
||||
ALK00 0.alk
|
||||
ALK09 9.alk
|
||||
|
||||
SaveA ~/save/foo_sa.asd
|
||||
SaveZ /tmp/foo_sz.asd
|
||||
+2
-2
@@ -27,7 +27,7 @@
|
||||
#include <emscripten.h>
|
||||
|
||||
void texthook_message(const char *m) {
|
||||
BYTE* s = sjis2lang((BYTE*)m);
|
||||
BYTE* s = sjis2utf((BYTE*)m);
|
||||
EM_ASM_({ xsystem35.texthook.message(UTF8ToString($0), $1); },
|
||||
s, sl_getPage());
|
||||
free(s);
|
||||
@@ -53,7 +53,7 @@ static int newlines = 0;
|
||||
void texthook_message(const char *m) {
|
||||
if (newlines)
|
||||
printf("%d:", sl_getPage());
|
||||
BYTE* s = sjis2lang((BYTE*)m);
|
||||
BYTE* s = sjis2utf((BYTE*)m);
|
||||
printf("%s", s);
|
||||
free(s);
|
||||
newlines = 0;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user