Compare commits
1 Commits
master
...
Daverball/
Author | SHA1 | Date |
---|---|---|
David Salvisberg | 160bfc0702 |
|
@ -1,5 +0,0 @@
|
|||
root=true
|
||||
[*]
|
||||
end_of_line = lf
|
||||
indent_style = tab
|
||||
indent_size = 4
|
|
@ -110,7 +110,6 @@ set(MAIN_HEADERS
|
|||
src/flashable.h
|
||||
src/font.h
|
||||
src/input.h
|
||||
src/iniconfig.h
|
||||
src/plane.h
|
||||
src/scene.h
|
||||
src/sprite.h
|
||||
|
@ -168,7 +167,6 @@ set(MAIN_SOURCE
|
|||
src/filesystem.cpp
|
||||
src/font.cpp
|
||||
src/input.cpp
|
||||
src/iniconfig.cpp
|
||||
src/plane.cpp
|
||||
src/scene.cpp
|
||||
src/sprite.cpp
|
||||
|
@ -207,31 +205,21 @@ set(MAIN_SOURCE
|
|||
src/fluid-fun.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND MAIN_HEADERS windows/resource.h)
|
||||
list(APPEND MAIN_SOURCE windows/resource.rc)
|
||||
endif()
|
||||
|
||||
source_group("MKXP Source" FILES ${MAIN_SOURCE} ${MAIN_HEADERS})
|
||||
|
||||
## Setup embedded source ##
|
||||
|
||||
set(EMBEDDED_INPUT
|
||||
shader/common.h
|
||||
shader/transSimple.frag
|
||||
shader/trans.frag
|
||||
shader/hue.frag
|
||||
shader/sprite.frag
|
||||
shader/plane.frag
|
||||
shader/gray.frag
|
||||
shader/bitmapBlit.frag
|
||||
shader/flatColor.frag
|
||||
shader/simple.frag
|
||||
shader/simpleColor.frag
|
||||
shader/simpleAlpha.frag
|
||||
shader/simpleAlphaUni.frag
|
||||
shader/flashMap.frag
|
||||
shader/minimal.vert
|
||||
shader/simple.vert
|
||||
shader/simpleColor.vert
|
||||
shader/sprite.vert
|
||||
|
@ -241,6 +229,7 @@ set(EMBEDDED_INPUT
|
|||
shader/blurH.vert
|
||||
shader/blurV.vert
|
||||
shader/simpleMatrix.vert
|
||||
assets/gamecontrollerdb.txt
|
||||
assets/liberation.ttf
|
||||
assets/icon.png
|
||||
)
|
||||
|
@ -412,12 +401,10 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
|
|||
)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||
src
|
||||
windows
|
||||
${SIGCXX_INCLUDE_DIRS}
|
||||
${PIXMAN_INCLUDE_DIRS}
|
||||
${PHYSFS_INCLUDE_DIRS}
|
||||
${SDL2_INCLUDE_DIRS} # Blindly assume other SDL bits are in same directory
|
||||
${SDL_SOUND_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIR}
|
||||
${MRI_INCLUDE_DIRS}
|
||||
${VORBISFILE_INCLUDE_DIRS}
|
||||
|
|
27
README.md
27
README.md
|
@ -1,19 +1,13 @@
|
|||
# mkxp
|
||||
|
||||
Discord community: https://discord.gg/A8xHE8P
|
||||
Matrix space: https://matrix.to/#/#rpgmaker:mapleshrine.eu
|
||||
Further links: https://mapleshrine.eu
|
||||
|
||||
mkxp is a project that seeks to provide a fully open source implementation of the Ruby Game Scripting System (RGSS) interface used in the popular game creation software "RPG Maker XP", "RPG Maker VX" and "RPG Maker VX Ace" (trademark by Enterbrain, Inc.), with focus on Linux. The goal is to be able to run games created with the above software natively without changing a single file.
|
||||
|
||||
It is licensed under the GNU General Public License v2+.
|
||||
|
||||
## Prebuilt binaries
|
||||
[**Linux / Windows**](https://www.mapleshrine.eu/releases/)
|
||||
[**Linux (32bit/64bit)**](http://ancurio.bplaced.net/mkxp/generic/)
|
||||
[**OSX**](https://app.box.com/mkxpmacbuilds) by Ali
|
||||
|
||||
## Should I use mkxp
|
||||
mkxp primarily targets technically versed users that are comfortable with Ruby / RGSS, and ideally know how to compile the project themselves. The reason for this is that for most games, due to Win32-API usage, mkxp is simply not a plug-and-play solution, but a building block with which a fully cross-platform version can be created in time.
|
||||
[**Windows (mingw-w64 32bit)**](http://ancurio.bplaced.net/mkxp/mingw32/)
|
||||
|
||||
## Bindings
|
||||
Bindings provide the glue code for an interpreted language environment to run game scripts in. Currently there are three bindings:
|
||||
|
@ -26,8 +20,6 @@ Matz's Ruby Interpreter, also called CRuby, is the most widely deployed version
|
|||
For a list of differences, see:
|
||||
http://stackoverflow.com/questions/21574/what-is-the-difference-between-ruby-1-8-and-ruby-1-9
|
||||
|
||||
This binding supports RGSS1, RGSS2 and RGSS3.
|
||||
|
||||
### mruby (Lightweight Ruby)
|
||||
Website: https://github.com/mruby/mruby
|
||||
|
||||
|
@ -37,8 +29,6 @@ Due to heavy differences between mruby and MRI as well as lacking modules, runni
|
|||
|
||||
Some extensions to the standard classes/modules are provided, taking the RPG Maker XP helpfile as a quasi "reference". These include Marshal, File, FileTest and Time.
|
||||
|
||||
This binding only supports RGSS1.
|
||||
|
||||
**Important:** If you decide to use [mattn's oniguruma regexp gem](https://github.com/mattn/mruby-onig-regexp), don't forget to add `-lonig` to the linker flags to avoid ugly symbol overlaps with libc.
|
||||
|
||||
### null
|
||||
|
@ -54,7 +44,7 @@ This binding only exists for testing purposes and does nothing (the engine quits
|
|||
* SDL2*
|
||||
* SDL2_image
|
||||
* SDL2_ttf
|
||||
* [my SDL_sound fork](https://github.com/Ancurio/SDL_sound)
|
||||
* SDL_sound (latest hg, apply provided patches!)
|
||||
* vorbisfile
|
||||
* pixman
|
||||
* zlib (only ruby bindings)
|
||||
|
@ -87,10 +77,6 @@ These depend on the SDL auxiliary libraries. For maximum RGSS compliance, build
|
|||
|
||||
To run mkxp, you should have a graphics card capable of at least **OpenGL (ES) 2.0** with an up-to-date driver installed.
|
||||
|
||||
## Dependency kit
|
||||
|
||||
To facilitate hacking, I have assembled a package containing all dependencies to compile mkxp on a bare-bones Ubuntu 12.04 64bit installation. Compatibility with other distributions has not been tested. You can download it [here](https://mapleshrine.eu/depkits/linux64.tar.xz). Read the "README" for instructions.
|
||||
|
||||
## Configuration
|
||||
|
||||
mkxp reads configuration data from the file "mkxp.conf". The format is ini-style. Do *not* use quotes around file paths (spaces won't break). Lines starting with '#' are comments. See 'mkxp.conf.sample' for a list of accepted entries.
|
||||
|
@ -101,11 +87,13 @@ The syntax is: `--<option>=<value>`
|
|||
|
||||
Example: `./mkxp --gameFolder="my game" --vsync=true --fixedFramerate=60`
|
||||
|
||||
## Midi music
|
||||
## Midi music (*ALPHA STATUS*)
|
||||
|
||||
mkxp doesn't come with a soundfont by default, so you will have to supply it yourself (set its path in the config). Playback has been tested and should work reasonably well with all RTP assets.
|
||||
|
||||
You can use this public domain soundfont: [GMGSx.sf2](https://mapleshrine.eu/unsorted/GMGSx.sf2)
|
||||
Known issues with midi playback:
|
||||
|
||||
* Some songs' instruments become mute after looping
|
||||
|
||||
## Fonts
|
||||
|
||||
|
@ -115,6 +103,7 @@ If a requested font is not found, no error is generated. Instead, a built-in fon
|
|||
|
||||
## What doesn't work (yet)
|
||||
|
||||
* Text outline
|
||||
* Movie playback
|
||||
* wma audio files
|
||||
* The Win32API ruby class (for obvious reasons)
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
# Windows - DINPUT
|
||||
8f0e1200000000000000504944564944,Acme,platform:Windows,x:b2,a:b0,b:b1,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,
|
||||
341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
|
||||
ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
|
||||
6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
|
||||
6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
|
||||
88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows,
|
||||
4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Windows,
|
||||
25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,platform:Windows,
|
||||
4c05c405000000000000504944564944,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
|
||||
xinput,X360 Controller,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b0,guide:b14,leftshoulder:b8,leftstick:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:a5,rightx:a2,righty:a3,start:b4,x:b12,y:b13,platform:Windows,
|
||||
6d0418c2000000000000504944564944,Logitech RumblePad 2 USB,platform:Windows,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,
|
||||
36280100000000000000504944564944,OUYA Controller,platform:Windows,a:b0,b:b3,y:b2,x:b1,start:b14,guide:b15,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b8,dpleft:b10,dpdown:b9,dpright:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b12,righttrigger:b13,
|
||||
4f0400b3000000000000504944564944,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Windows,
|
||||
00f00300000000000000504944564944,RetroUSB.com RetroPad,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Windows,
|
||||
00f0f100000000000000504944564944,RetroUSB.com Super RetroPort,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Windows,
|
||||
28040140000000000000504944564944,GamePad Pro USB,platform:Windows,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,lefttrigger:b6,righttrigger:b7,
|
||||
ff113133000000000000504944564944,SVEN X-PAD,platform:Windows,a:b2,b:b3,y:b1,x:b0,start:b5,back:b4,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b8,righttrigger:b9,
|
||||
|
||||
# OS X
|
||||
0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,
|
||||
6d0400000000000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
|
||||
6d0400000000000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
|
||||
6d040000000000001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
|
||||
6d0400000000000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
|
||||
4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Mac OS X,
|
||||
4c05000000000000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,Platform:Mac OS X,
|
||||
5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
|
||||
891600000000000000fd000000000000,Razer Onza Tournament,a:b0,b:b1,y:b3,x:b2,start:b8,guide:b10,back:b9,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b11,dpleft:b13,dpdown:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Mac OS X,
|
||||
4f0400000000000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Mac OS X,
|
||||
|
||||
# Linux
|
||||
0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
|
||||
03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
|
||||
030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
|
||||
030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
|
||||
030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
|
||||
030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
|
||||
030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
|
||||
030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
|
||||
030000004c050000c405000011010000,Sony DualShock 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,platform:Linux,
|
||||
03000000de280000ff11000001000000,Valve Streaming Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
|
||||
030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
|
||||
030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
|
||||
030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
|
||||
03000000100800000100000010010000,Twin USB PS2 Adapter,a:b2,b:b1,y:b0,x:b3,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,platform:Linux,
|
||||
03000000a306000023f6000011010000,Saitek Cyborg V.1 Game Pad,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7,platform:Linux,
|
||||
030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,y:b3,x:b1,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Linux,
|
||||
030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a5,
|
||||
030000008f0e00000300000010010000,GreenAsia Inc. USB Joystick ,platform:Linux,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,
|
||||
030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick ,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,
|
||||
030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b11,dpdown:b14,dpright:b12,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux,
|
||||
030000006d04000016c2000010010000,Logitech Logitech Dual Action,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,
|
||||
03000000260900008888000000010000,GameCube {WiseGroup USB box},a:b0,b:b2,y:b3,x:b1,start:b7,leftshoulder:,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,rightstick:,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Linux,
|
||||
030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,y:b4,x:b3,start:b8,guide:b5,back:b2,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b9,righttrigger:b10,platform:Linux,
|
||||
030000006d04000018c2000010010000,Logitech Logitech RumblePad 2 USB,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,
|
||||
05000000d6200000ad0d000001000000,Moga Pro,platform:Linux,a:b0,b:b1,y:b3,x:b2,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,
|
||||
030000004f04000009d0000000010000,Thrustmaster Run N Drive Wireless PS3,platform:Linux,a:b1,b:b2,x:b0,y:b3,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,
|
||||
030000004f04000008d0000000010000,Thrustmaster Run N Drive Wireless,platform:Linux,a:b1,b:b2,x:b0,y:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,
|
||||
0300000000f000000300000000010000,RetroUSB.com RetroPad,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Linux,
|
||||
0300000000f00000f100000000010000,RetroUSB.com Super RetroPort,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Linux,
|
||||
030000006f0e00001f01000000010000,Generic X-Box pad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,
|
||||
03000000280400000140000000010000,Gravis GamePad Pro USB ,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftx:a0,lefty:a1,
|
||||
030000005e0400008902000021010000,Microsoft X-Box pad v2 (US),platform:Linux,x:b3,a:b0,b:b1,y:b4,back:b6,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b5,lefttrigger:a2,rightshoulder:b2,righttrigger:a5,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a3,righty:a4,
|
||||
030000006f0e00001e01000011010000,Rock Candy Gamepad for PS3,platform:Linux,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,guide:b12,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,
|
||||
03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,platform:Linux,a:b2,b:b1,y:b0,x:b3,start:b8,back:b9,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5,
|
||||
030000008916000000fd000024010000,Razer Onza Tournament,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b11,dpdown:b14,dpright:b12,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux,
|
||||
030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Linux,
|
||||
03000000ad1b000001f5000033050000,Hori Pad EX Turbo 2,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux,
|
||||
050000004c050000c405000000010000,PS4 Controller (Bluetooth),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
|
||||
060000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,y:b12,x:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b7,dpdown:b6,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9,platform:Linux,
|
||||
03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick ,platform:Linux,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,
|
||||
03000000666600000488000000010000,Super Joy Box 5 Pro,platform:Linux,a:b2,b:b1,x:b3,y:b0,back:b9,start:b8,leftshoulder:b6,rightshoulder:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5,dpup:b12,dpleft:b15,dpdown:b14,dpright:b13,
|
||||
05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,platform:Linux,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,
|
||||
05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,platform:Linux,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -97,15 +97,6 @@ DEF_FADE( me )
|
|||
|
||||
DEF_PLAY_STOP( se )
|
||||
|
||||
RB_METHOD(audioSetupMidi)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
shState->audio().setupMidi();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(audioReset)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
@ -144,8 +135,6 @@ audioBindingInit()
|
|||
{
|
||||
BIND_POS( bgm );
|
||||
BIND_POS( bgs );
|
||||
|
||||
_rb_define_module_function(module, "setup_midi", audioSetupMidi);
|
||||
}
|
||||
|
||||
BIND_PLAY_STOP( se )
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -25,7 +25,6 @@
|
|||
#include "eventthread.h"
|
||||
#include "filesystem.h"
|
||||
#include "util.h"
|
||||
#include "sdl-util.h"
|
||||
#include "debugwriter.h"
|
||||
#include "graphics.h"
|
||||
#include "audio.h"
|
||||
|
@ -80,7 +79,6 @@ RB_METHOD(mriP);
|
|||
RB_METHOD(mkxpDataDirectory);
|
||||
RB_METHOD(mkxpPuts);
|
||||
RB_METHOD(mkxpRawKeyStates);
|
||||
RB_METHOD(mkxpMouseInWindow);
|
||||
|
||||
RB_METHOD(mriRgssMain);
|
||||
RB_METHOD(mriRgssStop);
|
||||
|
@ -145,18 +143,8 @@ static void mriBindingInit()
|
|||
_rb_define_module_function(mod, "data_directory", mkxpDataDirectory);
|
||||
_rb_define_module_function(mod, "puts", mkxpPuts);
|
||||
_rb_define_module_function(mod, "raw_key_states", mkxpRawKeyStates);
|
||||
_rb_define_module_function(mod, "mouse_in_window", mkxpMouseInWindow);
|
||||
|
||||
/* Load global constants */
|
||||
rb_gv_set("MKXP", Qtrue);
|
||||
|
||||
VALUE debug = rb_bool_new(shState->config().editor.debug);
|
||||
if (rgssVer == 1)
|
||||
rb_gv_set("DEBUG", debug);
|
||||
else if (rgssVer >= 2)
|
||||
rb_gv_set("TEST", debug);
|
||||
|
||||
rb_gv_set("BTEST", rb_bool_new(shState->config().editor.battleTest));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -204,11 +192,8 @@ RB_METHOD(mriP)
|
|||
RB_METHOD(mkxpDataDirectory)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
const std::string &path = shState->config().customDataPath;
|
||||
const char *s = path.empty() ? "." : path.c_str();
|
||||
|
||||
return rb_str_new_cstr(s);
|
||||
return rb_str_new_cstr(shState->config().customDataPath.c_str());
|
||||
}
|
||||
|
||||
RB_METHOD(mkxpPuts)
|
||||
|
@ -233,13 +218,6 @@ RB_METHOD(mkxpRawKeyStates)
|
|||
return str;
|
||||
}
|
||||
|
||||
RB_METHOD(mkxpMouseInWindow)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_bool_new(EventThread::mouseState.inWindow);
|
||||
}
|
||||
|
||||
static VALUE rgssMainCb(VALUE block)
|
||||
{
|
||||
rb_funcall2(block, rb_intern("call"), 0, 0);
|
||||
|
@ -358,7 +336,7 @@ static void runCustomScript(const std::string &filename)
|
|||
{
|
||||
std::string scriptData;
|
||||
|
||||
if (!readFileSDL(filename.c_str(), scriptData))
|
||||
if (!readFile(filename.c_str(), scriptData))
|
||||
{
|
||||
showMsg(std::string("Unable to open '") + filename + "'");
|
||||
return;
|
||||
|
@ -368,7 +346,7 @@ static void runCustomScript(const std::string &filename)
|
|||
newStringUTF8(filename.c_str(), filename.size()), NULL);
|
||||
}
|
||||
|
||||
VALUE kernelLoadDataInt(const char *filename, bool rubyExc);
|
||||
VALUE kernelLoadDataInt(const char *filename);
|
||||
|
||||
struct BacktraceData
|
||||
{
|
||||
|
@ -395,19 +373,7 @@ static void runRMXPScripts(BacktraceData &btData)
|
|||
return;
|
||||
}
|
||||
|
||||
VALUE scriptArray;
|
||||
|
||||
/* We checked if Scripts.rxdata exists, but something might
|
||||
* still go wrong */
|
||||
try
|
||||
{
|
||||
scriptArray = kernelLoadDataInt(scriptPack.c_str(), false);
|
||||
}
|
||||
catch (const Exception &e)
|
||||
{
|
||||
showMsg(std::string("Failed to read script data: ") + e.msg);
|
||||
return;
|
||||
}
|
||||
VALUE scriptArray = kernelLoadDataInt(scriptPack.c_str());
|
||||
|
||||
if (!RB_TYPE_P(scriptArray, RUBY_T_ARRAY))
|
||||
{
|
||||
|
@ -470,9 +436,8 @@ static void runRMXPScripts(BacktraceData &btData)
|
|||
}
|
||||
|
||||
/* Execute preloaded scripts */
|
||||
for (std::set<std::string>::iterator i = conf.preloadScripts.begin();
|
||||
i != conf.preloadScripts.end(); ++i)
|
||||
runCustomScript(*i);
|
||||
for (size_t i = 0; i < conf.preloadScripts.size(); ++i)
|
||||
runCustomScript(conf.preloadScripts[i]);
|
||||
|
||||
VALUE exc = rb_gv_get("$!");
|
||||
if (exc != Qnil)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -191,7 +191,7 @@ rb_get_args(int argc, VALUE *argv, const char *format, ...)
|
|||
if (!RB_TYPE_P(tmp, RUBY_T_STRING))
|
||||
rb_raise(rb_eTypeError, "Argument %d: Expected string", argI);
|
||||
|
||||
*s = RSTRING_PTR(tmp);
|
||||
*s = StringValueCStr(tmp);
|
||||
++argI;
|
||||
|
||||
break;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -67,7 +67,7 @@ raiseRbExc(const Exception &exc);
|
|||
|
||||
/* 2.1 has added a new field (flags) to rb_data_type_t */
|
||||
#include <ruby/version.h>
|
||||
#if RUBY_API_VERSION_MAJOR >= 2 && RUBY_API_VERSION_MINOR >= 1
|
||||
#if RUBY_API_VERSION_MINOR > 0
|
||||
/* TODO: can mkxp use RUBY_TYPED_FREE_IMMEDIATELY here? */
|
||||
#define DEF_TYPE_FLAGS 0
|
||||
#else
|
||||
|
@ -90,12 +90,7 @@ raiseRbExc(const Exception &exc);
|
|||
template<rb_data_type_t *rbType>
|
||||
static VALUE classAllocate(VALUE klass)
|
||||
{
|
||||
/* 2.3 has changed the name of this function */
|
||||
#if RUBY_API_VERSION_MAJOR >= 2 && RUBY_API_VERSION_MINOR >= 3
|
||||
return rb_data_typed_object_wrap(klass, 0, rbType);
|
||||
#else
|
||||
return rb_data_typed_object_alloc(klass, 0, rbType);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class C>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,7 +32,7 @@ DEF_TYPE(Bitmap);
|
|||
static const char *objAsStringPtr(VALUE obj)
|
||||
{
|
||||
VALUE str = rb_obj_as_string(obj);
|
||||
return RSTRING_PTR(str);
|
||||
return StringValueCStr(str);
|
||||
}
|
||||
|
||||
void bitmapInitProps(Bitmap *b, VALUE self)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,22 +40,18 @@ fileIntFreeInstance(void *inst)
|
|||
DEF_TYPE_CUSTOMFREE(FileInt, fileIntFreeInstance);
|
||||
|
||||
static VALUE
|
||||
fileIntForPath(const char *path, bool rubyExc)
|
||||
fileIntForPath(const char *path)
|
||||
{
|
||||
SDL_RWops *ops = SDL_AllocRW();
|
||||
|
||||
try
|
||||
{
|
||||
shState->fileSystem().openReadRaw(*ops, path);
|
||||
shState->fileSystem().openRead(*ops, path);
|
||||
}
|
||||
catch (const Exception &e)
|
||||
{
|
||||
SDL_FreeRW(ops);
|
||||
|
||||
if (rubyExc)
|
||||
raiseRbExc(e);
|
||||
else
|
||||
throw e;
|
||||
raiseRbExc(e);
|
||||
}
|
||||
|
||||
VALUE klass = rb_const_get(rb_cObject, rb_intern("FileInt"));
|
||||
|
@ -123,11 +119,11 @@ RB_METHOD(fileIntBinmode)
|
|||
}
|
||||
|
||||
VALUE
|
||||
kernelLoadDataInt(const char *filename, bool rubyExc)
|
||||
kernelLoadDataInt(const char *filename)
|
||||
{
|
||||
rb_gc_start();
|
||||
|
||||
VALUE port = fileIntForPath(filename, rubyExc);
|
||||
VALUE port = fileIntForPath(filename);
|
||||
|
||||
VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal"));
|
||||
|
||||
|
@ -146,7 +142,7 @@ RB_METHOD(kernelLoadData)
|
|||
const char *filename;
|
||||
rb_get_args(argc, argv, "z", &filename RB_ARG_END);
|
||||
|
||||
return kernelLoadDataInt(filename, true);
|
||||
return kernelLoadDataInt(filename);
|
||||
}
|
||||
|
||||
RB_METHOD(kernelSaveData)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -27,29 +27,6 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
static void
|
||||
collectStrings(VALUE obj, std::vector<std::string> &out)
|
||||
{
|
||||
if (RB_TYPE_P(obj, RUBY_T_STRING))
|
||||
{
|
||||
out.push_back(RSTRING_PTR(obj));
|
||||
}
|
||||
else if (RB_TYPE_P(obj, RUBY_T_ARRAY))
|
||||
{
|
||||
for (long i = 0; i < RARRAY_LEN(obj); ++i)
|
||||
{
|
||||
VALUE str = rb_ary_entry(obj, i);
|
||||
|
||||
/* Non-string objects are tolerated (ignored) */
|
||||
if (!RB_TYPE_P(str, RUBY_T_STRING))
|
||||
continue;
|
||||
|
||||
out.push_back(RSTRING_PTR(str));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEF_TYPE(Font);
|
||||
|
||||
RB_METHOD(fontDoesExist)
|
||||
|
@ -71,30 +48,12 @@ RB_METHOD(FontSetName);
|
|||
|
||||
RB_METHOD(fontInitialize)
|
||||
{
|
||||
VALUE namesObj = Qnil;
|
||||
VALUE name = Qnil;
|
||||
int size = 0;
|
||||
|
||||
rb_get_args(argc, argv, "|oi", &namesObj, &size RB_ARG_END);
|
||||
rb_get_args(argc, argv, "|oi", &name, &size RB_ARG_END);
|
||||
|
||||
Font *f;
|
||||
|
||||
if (NIL_P(namesObj))
|
||||
{
|
||||
namesObj = rb_iv_get(rb_obj_class(self), "default_name");
|
||||
f = new Font(0, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
collectStrings(namesObj, names);
|
||||
|
||||
f = new Font(&names, size);
|
||||
}
|
||||
|
||||
/* This is semantically wrong; the new Font object should take
|
||||
* a dup'ed object here in case of an array. Ditto for the setters.
|
||||
* However the same bug/behavior exists in all RM versions. */
|
||||
rb_iv_set(self, "name", namesObj);
|
||||
Font *f = new Font(0, size);
|
||||
|
||||
setPrivateData(self, f);
|
||||
|
||||
|
@ -106,6 +65,13 @@ RB_METHOD(fontInitialize)
|
|||
if (rgssVer >= 3)
|
||||
wrapProperty(self, &f->getOutColor(), "out_color", ColorType);
|
||||
|
||||
if (NIL_P(name))
|
||||
name = rb_iv_get(rb_obj_class(self), "default_name");
|
||||
|
||||
/* Going over the 'name=' function automatically causes
|
||||
* a possbile name array to be re-verified for existing fonts */
|
||||
FontSetName(1, &name, self);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -139,17 +105,57 @@ RB_METHOD(FontGetName)
|
|||
return rb_iv_get(self, "name");
|
||||
}
|
||||
|
||||
static void
|
||||
fontSetNameHelper(VALUE self, int argc, VALUE *argv,
|
||||
const char *nameIv, char *outBuf, size_t outLen)
|
||||
{
|
||||
rb_check_argc(argc, 1);
|
||||
|
||||
VALUE arg = argv[0];
|
||||
|
||||
// Fixme: in RGSS3, specifying "" (and only that) as font name results in
|
||||
// no text being drawn (everything else is substituted with Arial I think)
|
||||
strncpy(outBuf, "", outLen);
|
||||
|
||||
if (RB_TYPE_P(arg, RUBY_T_STRING))
|
||||
{
|
||||
strncpy(outBuf, RSTRING_PTR(arg), outLen);
|
||||
}
|
||||
else if (RB_TYPE_P(arg, RUBY_T_ARRAY))
|
||||
{
|
||||
for (long i = 0; i < RARRAY_LEN(arg); ++i)
|
||||
{
|
||||
VALUE str = rb_ary_entry(arg, i);
|
||||
|
||||
/* Non-string objects are tolerated (ignored) */
|
||||
if (!RB_TYPE_P(str, RUBY_T_STRING))
|
||||
continue;
|
||||
|
||||
const char *family = RSTRING_PTR(str);
|
||||
|
||||
/* We only set the core Font object's name attribute
|
||||
* to the actually existing font name */
|
||||
if (!shState->fontState().fontPresent(family))
|
||||
continue;
|
||||
|
||||
strncpy(outBuf, family, outLen);
|
||||
}
|
||||
}
|
||||
|
||||
/* RMXP doesn't even care if the argument type is
|
||||
* something other than string/array. Whatever... */
|
||||
rb_iv_set(self, nameIv, arg);
|
||||
}
|
||||
|
||||
RB_METHOD(FontSetName)
|
||||
{
|
||||
Font *f = getPrivateData<Font>(self);
|
||||
|
||||
rb_check_argc(argc, 1);
|
||||
char result[256];
|
||||
fontSetNameHelper(self, argc, argv, "default_name",
|
||||
result, sizeof(result));
|
||||
|
||||
std::vector<std::string> namesObj;
|
||||
collectStrings(argv[0], namesObj);
|
||||
|
||||
f->setName(namesObj);
|
||||
rb_iv_set(self, "name", argv[0]);
|
||||
f->setName(result);
|
||||
|
||||
return argv[0];
|
||||
}
|
||||
|
@ -217,15 +223,11 @@ RB_METHOD(FontGetDefaultName)
|
|||
|
||||
RB_METHOD(FontSetDefaultName)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
char result[256];
|
||||
fontSetNameHelper(self, argc, argv, "default_name",
|
||||
result, sizeof(result));
|
||||
|
||||
rb_check_argc(argc, 1);
|
||||
|
||||
std::vector<std::string> namesObj;
|
||||
collectStrings(argv[0], namesObj);
|
||||
|
||||
Font::setDefaultName(namesObj, shState->fontState());
|
||||
rb_iv_set(self, "default_name", argv[0]);
|
||||
Font::setDefaultName(result);
|
||||
|
||||
return argv[0];
|
||||
}
|
||||
|
@ -265,24 +267,7 @@ fontBindingInit()
|
|||
|
||||
Font::initDefaultDynAttribs();
|
||||
wrapProperty(klass, &Font::getDefaultColor(), "default_color", ColorType);
|
||||
|
||||
/* Initialize default names */
|
||||
const std::vector<std::string> &defNames = Font::getInitialDefaultNames();
|
||||
VALUE defNamesObj;
|
||||
|
||||
if (defNames.size() == 1)
|
||||
{
|
||||
defNamesObj = rb_str_new_cstr(defNames[0].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
defNamesObj = rb_ary_new2(defNames.size());
|
||||
|
||||
for (size_t i = 0; i < defNames.size(); ++i)
|
||||
rb_ary_push(defNamesObj, rb_str_new_cstr(defNames[i].c_str()));
|
||||
}
|
||||
|
||||
rb_iv_set(klass, "default_name", defNamesObj);
|
||||
rb_iv_set(klass, "default_name", rb_str_new_cstr(Font::getDefaultName()));
|
||||
|
||||
if (rgssVer >= 3)
|
||||
wrapProperty(klass, &Font::getDefaultOutColor(), "default_out_color", ColorType);
|
||||
|
@ -325,4 +310,14 @@ fontBindingInit()
|
|||
INIT_PROP_BIND(Font, Outline, "outline");
|
||||
INIT_PROP_BIND(Font, OutColor, "out_color");
|
||||
}
|
||||
|
||||
if (rgssVer >= 2)
|
||||
{
|
||||
VALUE defNames = rb_ary_new2(3);
|
||||
rb_ary_push(defNames, rb_str_new2("Verdana"));
|
||||
rb_ary_push(defNames, rb_str_new2("Arial"));
|
||||
rb_ary_push(defNames, rb_str_new2("Courier New"));
|
||||
|
||||
FontSetDefaultName(1, &defNames, klass);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -48,7 +48,7 @@ RB_METHOD(graphicsTransition)
|
|||
RB_UNUSED_PARAM;
|
||||
|
||||
int duration = 8;
|
||||
const char *filename = "";
|
||||
const char *filename = 0;
|
||||
int vague = 40;
|
||||
|
||||
rb_get_args(argc, argv, "|izi", &duration, &filename, &vague RB_ARG_END);
|
||||
|
@ -183,18 +183,6 @@ RB_METHOD(graphicsReset)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsPlayMovie)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
const char *filename;
|
||||
rb_get_args(argc, argv, "z", &filename RB_ARG_END);
|
||||
|
||||
shState->graphics().playMovie(filename);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
DEF_GRA_PROP_I(FrameRate)
|
||||
DEF_GRA_PROP_I(FrameCount)
|
||||
DEF_GRA_PROP_I(Brightness)
|
||||
|
@ -235,11 +223,6 @@ void graphicsBindingInit()
|
|||
INIT_GRA_PROP_BIND( Brightness, "brightness" );
|
||||
}
|
||||
|
||||
if (rgssVer >= 3)
|
||||
{
|
||||
_rb_define_module_function(module, "play_movie", graphicsPlayMovie);
|
||||
}
|
||||
|
||||
INIT_GRA_PROP_BIND( Fullscreen, "fullscreen" );
|
||||
INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" );
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -56,7 +56,6 @@ DEF_PROP_I(Sprite, Y)
|
|||
DEF_PROP_I(Sprite, OX)
|
||||
DEF_PROP_I(Sprite, OY)
|
||||
DEF_PROP_I(Sprite, BushDepth)
|
||||
DEF_PROP_I(Sprite, BushOpacity)
|
||||
DEF_PROP_I(Sprite, Opacity)
|
||||
DEF_PROP_I(Sprite, BlendType)
|
||||
DEF_PROP_I(Sprite, WaveAmp)
|
||||
|
@ -127,8 +126,6 @@ spriteBindingInit()
|
|||
_rb_define_method(klass, "width", spriteWidth);
|
||||
_rb_define_method(klass, "height", spriteHeight);
|
||||
|
||||
INIT_PROP_BIND( Sprite, BushOpacity, "bush_opacity" );
|
||||
|
||||
INIT_PROP_BIND( Sprite, WaveAmp, "wave_amp" );
|
||||
INIT_PROP_BIND( Sprite, WaveLength, "wave_length" );
|
||||
INIT_PROP_BIND( Sprite, WaveSpeed, "wave_speed" );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -114,17 +114,8 @@ static void mrbBindingInit(mrb_state *mrb)
|
|||
/* Load RPG module */
|
||||
mrb_load_irep(mrb, mrbModuleRPG);
|
||||
|
||||
/* Load global constants */
|
||||
mrb_define_global_const(mrb, "MKXP", mrb_true_value());
|
||||
|
||||
mrb_value debug = rb_bool_new(shState->config().editor.debug);
|
||||
if (rgssVer == 1)
|
||||
mrb_define_global_const(mrb, "DEBUG", debug);
|
||||
else if (rgssVer >= 2)
|
||||
mrb_define_global_const(mrb, "TEST", debug);
|
||||
|
||||
mrb_define_global_const(mrb, "BTEST", mrb_bool_value(shState->config().editor.battleTest));
|
||||
|
||||
mrb_gc_arena_restore(mrb, arena);
|
||||
}
|
||||
|
||||
|
@ -275,7 +266,7 @@ runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
|
|||
mrb_state *scriptMrb = mrb_open();
|
||||
SDL_RWops ops;
|
||||
|
||||
shState->fileSystem().openReadRaw(ops, scriptPack.c_str());
|
||||
shState->fileSystem().openRead(ops, scriptPack.c_str());
|
||||
|
||||
mrb_value scriptArray = mrb_nil_value();
|
||||
std::string readError;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -45,7 +45,7 @@ MRB_FUNCTION(graphicsFreeze)
|
|||
MRB_FUNCTION(graphicsTransition)
|
||||
{
|
||||
mrb_int duration = 8;
|
||||
const char *filename = "";
|
||||
const char *filename = 0;
|
||||
mrb_int vague = 40;
|
||||
|
||||
mrb_get_args(mrb, "|izi", &duration, &filename, &vague);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,14 +1,4 @@
|
|||
# Lines starting with '#' are comments.
|
||||
#
|
||||
# About filesystem paths specified in this config:
|
||||
# The "gameFolder" path is resolved either relative
|
||||
# to the directory containing the mkxp executable
|
||||
# (the default behavior), or relative to the current
|
||||
# working directory (when compiled with
|
||||
# -DWORKDIR_CURRENT). All other paths are resolved
|
||||
# relative to gameFolder and ignoring both RTPs and
|
||||
# encrypted archives.
|
||||
|
||||
# Lines starting with '#' are comments
|
||||
|
||||
# Specify the RGSS version to run under.
|
||||
# Possible values are 0, 1, 2, 3. If set to 0,
|
||||
|
@ -27,14 +17,6 @@
|
|||
# debugMode=false
|
||||
|
||||
|
||||
# Continuously print average FPS to console.
|
||||
# This setting does not affect the window title
|
||||
# FPS display toggled via F2
|
||||
# (default: disabled)
|
||||
#
|
||||
# printFPS=false
|
||||
|
||||
|
||||
# Game window is resizable
|
||||
# (default: disabled)
|
||||
#
|
||||
|
@ -57,9 +39,9 @@
|
|||
|
||||
# Apply linear interpolation when game screen
|
||||
# is upscaled
|
||||
# (default: enabled)
|
||||
# (default: disabled)
|
||||
#
|
||||
# smoothScaling=true
|
||||
# smoothScaling=false
|
||||
|
||||
|
||||
# Sync screen redraws to the monitor refresh rate
|
||||
|
@ -86,12 +68,6 @@
|
|||
# defScreenH=480
|
||||
|
||||
|
||||
# Override the game window title
|
||||
# (default: none)
|
||||
#
|
||||
# windowTitle=Custom Title
|
||||
|
||||
|
||||
# Enforce a static frame rate
|
||||
# (0 = disabled)
|
||||
#
|
||||
|
@ -104,52 +80,12 @@
|
|||
# frameSkip=true
|
||||
|
||||
|
||||
# Use a fixed framerate that is approx. equal to the
|
||||
# native screen refresh rate. This is different from
|
||||
# "fixedFramerate" because the actual frame rate is
|
||||
# reported back to the game, ensuring correct timers.
|
||||
# If the screen refresh rate cannot be determined,
|
||||
# this option is force-disabled
|
||||
# (default: disabled)
|
||||
#
|
||||
# syncToRefreshrate=false
|
||||
|
||||
|
||||
# Don't use alpha blending when rendering text
|
||||
# (default: disabled)
|
||||
#
|
||||
# solidFonts=false
|
||||
|
||||
|
||||
# Work around buggy graphics drivers which don't
|
||||
# properly synchronize texture access, most
|
||||
# apparent when text doesn't show up or the map
|
||||
# tileset doesn't render at all
|
||||
# (default: disabled)
|
||||
#
|
||||
# subImageFix=false
|
||||
|
||||
|
||||
# Enable framebuffer blitting if the driver is
|
||||
# capable of it. Some drivers carry buggy
|
||||
# implementations of this functionality, so
|
||||
# disabling it can be used as a workaround
|
||||
# (default: enabled)
|
||||
#
|
||||
# enableBlitting=true
|
||||
|
||||
|
||||
# Limit the maximum size (width, height) of
|
||||
# most textures mkxp will create (exceptions are
|
||||
# rendering backbuffers and similar).
|
||||
# If set to 0, the hardware maximum is used.
|
||||
# This is useful for recording traces that can
|
||||
# be played back on machines with lower specs.
|
||||
# (default: 0)
|
||||
#
|
||||
# maxTextureSize=0
|
||||
|
||||
|
||||
# Set the base path of the game to '/path/to/game'
|
||||
# (default: executable directory)
|
||||
#
|
||||
|
@ -282,19 +218,6 @@
|
|||
# SE.sourceCount=6
|
||||
|
||||
|
||||
# The Windows game executable name minus ".exe". By default
|
||||
# this is "Game", but some developers manually rename it.
|
||||
# mkxp needs this name because both the .ini (game
|
||||
# configuration) and .rgssad (encrypted data archive) must
|
||||
# carry the same name minus their extension, and we cannot
|
||||
# guess the executable's name.
|
||||
# You could just as well rename them both to "Game.ini" and
|
||||
# "Game.rgssad", but specifying the executable name here
|
||||
# is a tiny bit less intrusive.
|
||||
#
|
||||
# execName=Game
|
||||
|
||||
|
||||
# Give a hint on which language the game title as
|
||||
# specified in the Game.ini is, useful if the encoding
|
||||
# is being falsely detected. Relevant only if mkxp was
|
||||
|
|
12
mkxp.pro
12
mkxp.pro
|
@ -8,10 +8,6 @@ INCLUDEPATH += . src
|
|||
|
||||
CONFIG(release, debug|release): DEFINES += NDEBUG
|
||||
|
||||
CONFIG += c++11
|
||||
# And for older qmake versions..
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
|
||||
isEmpty(BINDING) {
|
||||
BINDING = MRI
|
||||
}
|
||||
|
@ -93,7 +89,6 @@ HEADERS += \
|
|||
src/flashable.h \
|
||||
src/font.h \
|
||||
src/input.h \
|
||||
src/iniconfig.h \
|
||||
src/plane.h \
|
||||
src/scene.h \
|
||||
src/sprite.h \
|
||||
|
@ -150,7 +145,6 @@ SOURCES += \
|
|||
src/filesystem.cpp \
|
||||
src/font.cpp \
|
||||
src/input.cpp \
|
||||
src/iniconfig.cpp \
|
||||
src/plane.cpp \
|
||||
src/scene.cpp \
|
||||
src/sprite.cpp \
|
||||
|
@ -189,21 +183,16 @@ SOURCES += \
|
|||
src/fluid-fun.cpp
|
||||
|
||||
EMBED = \
|
||||
shader/common.h \
|
||||
shader/transSimple.frag \
|
||||
shader/trans.frag \
|
||||
shader/hue.frag \
|
||||
shader/sprite.frag \
|
||||
shader/plane.frag \
|
||||
shader/gray.frag \
|
||||
shader/bitmapBlit.frag \
|
||||
shader/flatColor.frag \
|
||||
shader/simple.frag \
|
||||
shader/simpleColor.frag \
|
||||
shader/simpleAlpha.frag \
|
||||
shader/simpleAlphaUni.frag \
|
||||
shader/flashMap.frag \
|
||||
shader/minimal.vert \
|
||||
shader/simple.vert \
|
||||
shader/simpleColor.vert \
|
||||
shader/sprite.vert \
|
||||
|
@ -213,6 +202,7 @@ EMBED = \
|
|||
shader/blurV.vert \
|
||||
shader/simpleMatrix.vert \
|
||||
shader/tilemapvx.vert \
|
||||
assets/gamecontrollerdb.txt \
|
||||
assets/liberation.ttf \
|
||||
assets/icon.png
|
||||
|
||||
|
|
|
@ -0,0 +1,365 @@
|
|||
diff -r 719dade41745 decoders/wav.c
|
||||
--- a/decoders/wav.c Wed Aug 15 23:52:18 2012 -0400
|
||||
+++ b/decoders/wav.c Fri Sep 12 06:50:35 2014 +0200
|
||||
@@ -113,8 +113,9 @@
|
||||
|
||||
#define fmtID 0x20746D66 /* "fmt ", in ascii. */
|
||||
|
||||
-#define FMT_NORMAL 0x0001 /* Uncompressed waveform data. */
|
||||
-#define FMT_ADPCM 0x0002 /* ADPCM compressed waveform data. */
|
||||
+#define FMT_NORMAL 0x0001 /* Uncompressed waveform data. */
|
||||
+#define FMT_ADPCM 0x0002 /* ADPCM compressed waveform data. */
|
||||
+#define FMT_IMA 0x0011 /* IMA ADPCM compressed waveform data. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -130,6 +131,12 @@
|
||||
Sint16 iSamp2;
|
||||
} ADPCMBLOCKHEADER;
|
||||
|
||||
+typedef struct
|
||||
+{
|
||||
+ Sint16 iPrevSamp;
|
||||
+ Uint8 iStepIndex;
|
||||
+} IMAADPCMDATA;
|
||||
+
|
||||
typedef struct S_WAV_FMT_T
|
||||
{
|
||||
Uint32 chunkID;
|
||||
@@ -166,6 +173,25 @@
|
||||
Sint8 nibble;
|
||||
} adpcm;
|
||||
|
||||
+ struct
|
||||
+ {
|
||||
+ /* per channel decoder state */
|
||||
+ IMAADPCMDATA *d;
|
||||
+ /* auxiliary buffer */
|
||||
+ Uint8 *buf;
|
||||
+
|
||||
+ Uint16 block_frames;
|
||||
+ Uint16 block_framesets;
|
||||
+ Uint16 enc_frameset_size;
|
||||
+ Uint16 headerset_size;
|
||||
+ Uint16 dec_frame_size;
|
||||
+ Uint16 dec_frameset_size;
|
||||
+ Uint16 rem_block_framesets;
|
||||
+
|
||||
+ /* whether the next word(s) are the start of a new block */
|
||||
+ int read_header;
|
||||
+ } ima;
|
||||
+
|
||||
/* put other format-specific data here... */
|
||||
} fmt;
|
||||
} fmt_t;
|
||||
@@ -614,6 +640,296 @@
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
+ * IMA ADPCM compression handler... *
|
||||
+ *****************************************************************************/
|
||||
+
|
||||
+static const int ima_index_table[16] =
|
||||
+{
|
||||
+ -1, -1, -1, -1, 2, 4, 6, 8,
|
||||
+ -1, -1, -1, -1, 2, 4, 6, 8
|
||||
+};
|
||||
+
|
||||
+static const int ima_step_table[89] =
|
||||
+{
|
||||
+ 7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
|
||||
+ 19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
|
||||
+ 50, 55, 60, 66, 73, 80, 88, 97, 107, 118,
|
||||
+ 130, 143, 157, 173, 190, 209, 230, 253, 279, 307,
|
||||
+ 337, 371, 408, 449, 494, 544, 598, 658, 724, 796,
|
||||
+ 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066,
|
||||
+ 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358,
|
||||
+ 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
|
||||
+ 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767
|
||||
+};
|
||||
+
|
||||
+/* 1 frameset = 4 bytes (per channel) = 8 nibbles = 8 frames */
|
||||
+#define FRAMESET_FRAMES 8
|
||||
+
|
||||
+
|
||||
+static int read_ima_block_headers(SDL_RWops *rw, IMAADPCMDATA *d,
|
||||
+ Uint16 chan_count, Sint16 *out)
|
||||
+{
|
||||
+ Uint16 i;
|
||||
+ Uint8 dummy;
|
||||
+
|
||||
+ for (i = 0; i < chan_count; i++)
|
||||
+ {
|
||||
+ BAIL_IF_MACRO(!read_le16(rw, &d[i].iPrevSamp), NULL, 0);
|
||||
+ BAIL_IF_MACRO(!read_uint8(rw, &d[i].iStepIndex), NULL, 0);
|
||||
+ BAIL_IF_MACRO(!read_uint8(rw, &dummy), NULL, 0);
|
||||
+
|
||||
+ out[i] = d[i].iPrevSamp;
|
||||
+ } /* for */
|
||||
+
|
||||
+ return(1);
|
||||
+} /* read_ima_block_headers */
|
||||
+
|
||||
+
|
||||
+static Sint16 decode_ima_nibble(Uint8 nibble, IMAADPCMDATA *state)
|
||||
+{
|
||||
+ int step = ima_step_table[state->iStepIndex];
|
||||
+ int diff = 0;
|
||||
+ int samp, index;
|
||||
+
|
||||
+ if (nibble & 0x4)
|
||||
+ diff += step >> 0;
|
||||
+ if (nibble & 0x2)
|
||||
+ diff += step >> 1;
|
||||
+ if (nibble & 0x1)
|
||||
+ diff += step >> 2;
|
||||
+
|
||||
+ diff += step >> 3;
|
||||
+
|
||||
+ if (nibble & 0x8)
|
||||
+ diff = -diff;
|
||||
+
|
||||
+ samp = state->iPrevSamp + diff;
|
||||
+ samp = SDL_max(SDL_min(samp, 32767), -32768);
|
||||
+ state->iPrevSamp = samp;
|
||||
+
|
||||
+ index = state->iStepIndex + ima_index_table[nibble];
|
||||
+ state->iStepIndex = SDL_max(SDL_min(index, 88), 0);
|
||||
+
|
||||
+ return samp;
|
||||
+} /* decode_ima_nibble */
|
||||
+
|
||||
+
|
||||
+static int read_ima_frameset(SDL_RWops *rw, wav_t *wav, Sint16 *out)
|
||||
+{
|
||||
+ fmt_t *fmt = wav->fmt;
|
||||
+ Uint16 i, j;
|
||||
+ Uint8 *fs_buf = fmt->fmt.ima.buf;
|
||||
+ Uint32 fs_buf_size = fmt->fmt.ima.enc_frameset_size;
|
||||
+ Uint16 chan_count = fmt->wChannels;
|
||||
+ IMAADPCMDATA *data = fmt->fmt.ima.d;
|
||||
+
|
||||
+ /* read encoded frameset into temp buffer */
|
||||
+ BAIL_IF_MACRO(!SDL_RWread(rw, fs_buf, fs_buf_size, 1), NULL, 0);
|
||||
+
|
||||
+ for (i = 0; i < chan_count; i++)
|
||||
+ {
|
||||
+ for (j = 0; j < 4; j++)
|
||||
+ {
|
||||
+ Uint8 byte = fs_buf[i*4+j];
|
||||
+ Sint16 *_out = out + j*chan_count*2+i;
|
||||
+
|
||||
+ /* low nibble */
|
||||
+ *_out = decode_ima_nibble(byte & 0xF, &data[i]);
|
||||
+
|
||||
+ _out += chan_count;
|
||||
+
|
||||
+ /* high nibble */
|
||||
+ *_out = decode_ima_nibble(byte >> 4, &data[i]);
|
||||
+ }
|
||||
+ } /* for */
|
||||
+
|
||||
+ return(1);
|
||||
+} /* read_ima_frameset */
|
||||
+
|
||||
+
|
||||
+static Uint32 read_sample_fmt_ima(Sound_Sample *sample)
|
||||
+{
|
||||
+ Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
|
||||
+ wav_t *w = (wav_t *) internal->decoder_private;
|
||||
+ fmt_t *fmt = w->fmt;
|
||||
+ void *const out_buf = internal->buffer;
|
||||
+ Uint32 bw = 0;
|
||||
+ int rc;
|
||||
+
|
||||
+ while (1)
|
||||
+ {
|
||||
+ if (fmt->fmt.ima.read_header)
|
||||
+ {
|
||||
+ if (w->bytesLeft < fmt->fmt.ima.headerset_size)
|
||||
+ {
|
||||
+ sample->flags |= SOUND_SAMPLEFLAG_EOF;
|
||||
+ break;
|
||||
+ } /* if */
|
||||
+
|
||||
+ if (bw+fmt->fmt.ima.dec_frame_size > internal->buffer_size)
|
||||
+ break;
|
||||
+
|
||||
+ rc = read_ima_block_headers(internal->rw, fmt->fmt.ima.d,
|
||||
+ fmt->wChannels, (Sint16*) (out_buf+bw));
|
||||
+
|
||||
+ if (!rc)
|
||||
+ {
|
||||
+ sample->flags |= SOUND_SAMPLEFLAG_ERROR;
|
||||
+ return 0;
|
||||
+ } /* if */
|
||||
+
|
||||
+ w->bytesLeft -= fmt->fmt.ima.headerset_size;
|
||||
+ bw += fmt->fmt.ima.dec_frame_size;
|
||||
+
|
||||
+ fmt->fmt.ima.read_header = 0;
|
||||
+ fmt->fmt.ima.rem_block_framesets = fmt->fmt.ima.block_framesets;
|
||||
+ } /* if */
|
||||
+
|
||||
+ if (w->bytesLeft < fmt->fmt.ima.enc_frameset_size)
|
||||
+ {
|
||||
+ sample->flags |= SOUND_SAMPLEFLAG_EOF;
|
||||
+ break;
|
||||
+ } /* if */
|
||||
+
|
||||
+ if (bw+fmt->fmt.ima.dec_frameset_size > internal->buffer_size)
|
||||
+ break;
|
||||
+
|
||||
+ rc = read_ima_frameset(internal->rw, w, (Sint16*) (out_buf+bw));
|
||||
+
|
||||
+ if (!rc)
|
||||
+ {
|
||||
+ sample->flags |= SOUND_SAMPLEFLAG_ERROR;
|
||||
+ return 0;
|
||||
+ } /* if */
|
||||
+
|
||||
+ bw += fmt->fmt.ima.dec_frameset_size;
|
||||
+ w->bytesLeft -= fmt->fmt.ima.enc_frameset_size;
|
||||
+
|
||||
+ if (--fmt->fmt.ima.rem_block_framesets == 0)
|
||||
+ fmt->fmt.ima.read_header = 1;
|
||||
+ } /* while */
|
||||
+
|
||||
+ return(bw);
|
||||
+} /* read_sample_fmt_ima */
|
||||
+
|
||||
+
|
||||
+static void free_fmt_ima(fmt_t *fmt)
|
||||
+{
|
||||
+ free(fmt->fmt.ima.d);
|
||||
+ free(fmt->fmt.ima.buf);
|
||||
+} /* free_fmt_ima */
|
||||
+
|
||||
+
|
||||
+static int rewind_sample_fmt_ima(Sound_Sample *sample)
|
||||
+{
|
||||
+ Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
|
||||
+ wav_t *w = (wav_t *) internal->decoder_private;
|
||||
+ fmt_t *fmt = w->fmt;
|
||||
+
|
||||
+ fmt->fmt.ima.read_header = 1;
|
||||
+
|
||||
+ return(1);
|
||||
+} /* rewind_sample_fmt_ima */
|
||||
+
|
||||
+
|
||||
+static int seek_sample_fmt_ima(Sound_Sample *sample, Uint32 ms)
|
||||
+{
|
||||
+ Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
|
||||
+ wav_t *w = (wav_t *) internal->decoder_private;
|
||||
+ fmt_t *fmt = w->fmt;
|
||||
+ Sint16 *dummy_buf = (Sint16*) (fmt->fmt.ima.buf +
|
||||
+ fmt->fmt.ima.enc_frameset_size);
|
||||
+ Uint32 i;
|
||||
+ int rc, pos;
|
||||
+
|
||||
+ Uint32 seek_frames = (fmt->dwSamplesPerSec * ms) / 1000;
|
||||
+ Uint32 seek_blocks = seek_frames / fmt->fmt.ima.block_frames;
|
||||
+ Uint32 seek_framesets;
|
||||
+ seek_frames %= fmt->fmt.ima.block_frames;
|
||||
+
|
||||
+ w->bytesLeft = fmt->total_bytes;
|
||||
+ pos = seek_blocks * fmt->wBlockAlign + fmt->data_starting_offset;
|
||||
+ rc = SDL_RWseek(internal->rw, pos, SEEK_SET);
|
||||
+ BAIL_IF_MACRO(rc != pos, ERR_IO_ERROR, 0);
|
||||
+ w->bytesLeft -= seek_blocks * fmt->wBlockAlign;
|
||||
+
|
||||
+ fmt->fmt.ima.read_header = 0;
|
||||
+
|
||||
+ if (seek_frames == 0)
|
||||
+ {
|
||||
+ fmt->fmt.ima.read_header = 1;
|
||||
+ return(1);
|
||||
+ } /* if */
|
||||
+
|
||||
+ rc = read_ima_block_headers(internal->rw, fmt->fmt.ima.d,
|
||||
+ fmt->wChannels, dummy_buf);
|
||||
+ BAIL_IF_MACRO(!rc, NULL, 0);
|
||||
+ w->bytesLeft -= fmt->fmt.ima.headerset_size;
|
||||
+
|
||||
+ if (w->bytesLeft < fmt->fmt.ima.headerset_size)
|
||||
+ {
|
||||
+ sample->flags |= SOUND_SAMPLEFLAG_EOF;
|
||||
+ return(1);
|
||||
+ } /* if */
|
||||
+
|
||||
+ seek_frames -= 1;
|
||||
+ seek_framesets = seek_frames / FRAMESET_FRAMES;
|
||||
+
|
||||
+ for (i = 0; i < seek_framesets; i++)
|
||||
+ {
|
||||
+ rc = read_ima_frameset(internal->rw, w, dummy_buf);
|
||||
+ BAIL_IF_MACRO(!rc, NULL, 0);
|
||||
+ w->bytesLeft -= fmt->fmt.ima.enc_frameset_size;
|
||||
+ } /* for */
|
||||
+
|
||||
+ fmt->fmt.ima.rem_block_framesets =
|
||||
+ fmt->fmt.ima.block_framesets - seek_framesets;
|
||||
+
|
||||
+ if (w->bytesLeft < fmt->fmt.ima.enc_frameset_size)
|
||||
+ sample->flags |= SOUND_SAMPLEFLAG_EOF;
|
||||
+
|
||||
+ return(1); /* success. */
|
||||
+} /* seek_sample_fmt_ima */
|
||||
+
|
||||
+
|
||||
+static int read_fmt_ima(SDL_RWops *rw, fmt_t *fmt)
|
||||
+{
|
||||
+ Uint16 chan = fmt->wChannels;
|
||||
+ Sint16 extraBytes;
|
||||
+ int rc;
|
||||
+
|
||||
+ /* setup function pointers */
|
||||
+ fmt->free = free_fmt_ima;
|
||||
+ fmt->read_sample = read_sample_fmt_ima;
|
||||
+ fmt->rewind_sample = rewind_sample_fmt_ima;
|
||||
+ fmt->seek_sample = seek_sample_fmt_ima;
|
||||
+
|
||||
+ BAIL_IF_MACRO(!read_le16(rw, &extraBytes), NULL, 0);
|
||||
+ BAIL_IF_MACRO(!read_le16(rw, &fmt->fmt.ima.block_frames), NULL, 0);
|
||||
+
|
||||
+ /* skip to end of fmt chunk */
|
||||
+ rc = SDL_RWseek(rw, extraBytes-2, SEEK_CUR);
|
||||
+ BAIL_IF_MACRO(!rc, NULL, 0);
|
||||
+
|
||||
+ fmt->fmt.ima.block_framesets = (fmt->fmt.ima.block_frames-1) / FRAMESET_FRAMES;
|
||||
+ fmt->fmt.ima.enc_frameset_size = 4 * chan;
|
||||
+ fmt->fmt.ima.headerset_size = 4 * chan;
|
||||
+ fmt->fmt.ima.dec_frame_size = sizeof(Uint16) * chan;
|
||||
+ fmt->fmt.ima.dec_frameset_size = fmt->fmt.ima.dec_frame_size * FRAMESET_FRAMES;
|
||||
+ fmt->fmt.ima.read_header = 1;
|
||||
+
|
||||
+ fmt->fmt.ima.d = malloc(sizeof(IMAADPCMDATA) * chan);
|
||||
+
|
||||
+ size_t buf_size = fmt->fmt.ima.enc_frameset_size +
|
||||
+ fmt->fmt.ima.dec_frameset_size;
|
||||
+ fmt->fmt.ima.buf = malloc(buf_size);
|
||||
+
|
||||
+ return(1);
|
||||
+} /* read_fmt_ima */
|
||||
+
|
||||
+
|
||||
+
|
||||
+/*****************************************************************************
|
||||
* Everything else... *
|
||||
*****************************************************************************/
|
||||
|
||||
@@ -642,6 +958,13 @@
|
||||
SNDDBG(("WAV: Appears to be ADPCM compressed audio.\n"));
|
||||
return(read_fmt_adpcm(rw, fmt));
|
||||
|
||||
+ case FMT_IMA:
|
||||
+ if (fmt->wBitsPerSample == 4)
|
||||
+ {
|
||||
+ SNDDBG(("WAV: Appears to be 4bit IMA ADPCM compressed audio.\n"));
|
||||
+ return(read_fmt_ima(rw, fmt));
|
||||
+ }
|
||||
+
|
||||
/* add other types here. */
|
||||
|
||||
default:
|
|
@ -0,0 +1,54 @@
|
|||
diff -r 719dade41745 Makefile.am
|
||||
--- a/Makefile.am Wed Aug 15 23:52:18 2012 -0400
|
||||
+++ b/Makefile.am Thu Nov 28 18:42:40 2013 +0100
|
||||
@@ -1,8 +1,8 @@
|
||||
lib_LTLIBRARIES = libSDL_sound.la
|
||||
|
||||
-SUBDIRS = decoders . playsound
|
||||
+SUBDIRS = decoders .
|
||||
|
||||
-libSDL_soundincludedir = $(includedir)/SDL
|
||||
+libSDL_soundincludedir = $(includedir)/SDL2
|
||||
libSDL_soundinclude_HEADERS = \
|
||||
SDL_sound.h
|
||||
|
||||
@@ -49,3 +49,5 @@
|
||||
echo >> $(distdir)/docs/README
|
||||
rm -rf `find $(distdir) -type d -name ".svn"`
|
||||
|
||||
+pkgconfigdir = $(libdir)/pkgconfig
|
||||
+pkgconfig_DATA = SDL_sound.pc
|
||||
diff -r 719dade41745 SDL_sound.pc.in
|
||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
||||
+++ b/SDL_sound.pc.in Thu Nov 28 18:42:40 2013 +0100
|
||||
@@ -0,0 +1,11 @@
|
||||
+prefix=@prefix@
|
||||
+exec_prefix=@exec_prefix@
|
||||
+libdir=@libdir@
|
||||
+includedir=@includedir@
|
||||
+
|
||||
+Name: SDL_sound
|
||||
+Description: audio decoding library for Simple DirectMedia Layer
|
||||
+Version: @VERSION@
|
||||
+Requires: sdl2 >= @SDL_VERSION@
|
||||
+Libs: -L${libdir} -lSDL_sound
|
||||
+Cflags: -I${includedir}/SDL2
|
||||
diff -r 719dade41745 configure.in
|
||||
--- a/configure.in Wed Aug 15 23:52:18 2012 -0400
|
||||
+++ b/configure.in Thu Nov 28 18:42:40 2013 +0100
|
||||
@@ -107,7 +107,8 @@
|
||||
dnl ---------------------------------------------------------------------
|
||||
|
||||
dnl Check for SDL
|
||||
-SDL_VERSION=1.2.0
|
||||
+SDL_VERSION=2.0.0
|
||||
+AC_SUBST(SDL_VERSION)
|
||||
AM_PATH_SDL($SDL_VERSION,
|
||||
:,
|
||||
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
|
||||
@@ -339,4 +340,5 @@
|
||||
decoders/timidity/Makefile
|
||||
decoders/libmpg123/Makefile
|
||||
playsound/Makefile
|
||||
+SDL_sound.pc
|
||||
])
|
|
@ -1,43 +0,0 @@
|
|||
--- a/common.mk
|
||||
+++ b/common.mk
|
||||
@@ -95,6 +95,7 @@ COMMONOBJS = array.$(OBJEXT) \
|
||||
vm_trace.$(OBJEXT) \
|
||||
thread.$(OBJEXT) \
|
||||
cont.$(OBJEXT) \
|
||||
+ ext/zlib/zlib.$(OBJEXT) \
|
||||
$(BUILTIN_ENCOBJS) \
|
||||
$(BUILTIN_TRANSOBJS) \
|
||||
$(MISSING)
|
||||
diff --git a/ruby-2.1.5.orig/configure b/ruby-2.1.5/configure
|
||||
index d0f1f68..45ab642 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -2838,6 +2838,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
|
||||
|
||||
|
||||
|
||||
+LIBS="$LIBS -lz"
|
||||
+
|
||||
{ # environment section
|
||||
|
||||
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -31,6 +31,8 @@ rm() {
|
||||
}
|
||||
])])])
|
||||
|
||||
+LIBS="$LIBS -lz"
|
||||
+
|
||||
{ # environment section
|
||||
|
||||
AC_ARG_WITH(baseruby,
|
||||
--- a/inits.c
|
||||
+++ b/inits.c
|
||||
@@ -61,5 +61,6 @@ rb_call_inits(void)
|
||||
CALL(Complex);
|
||||
CALL(version);
|
||||
CALL(vm_trace);
|
||||
+ CALL(zlib);
|
||||
}
|
||||
#undef CALL
|
|
@ -6,7 +6,7 @@ uniform sampler2D destination;
|
|||
|
||||
uniform vec4 subRect;
|
||||
|
||||
uniform lowp float opacity;
|
||||
uniform float opacity;
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ varying vec2 v_blurCoord[2];
|
|||
|
||||
void main()
|
||||
{
|
||||
lowp vec4 frag = vec4(0, 0, 0, 0);
|
||||
vec4 frag = vec4(0, 0, 0, 0);
|
||||
|
||||
frag += texture2D(texture, v_texCoord);
|
||||
frag += texture2D(texture, v_blurCoord[0]);
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#ifdef GLSLES
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
/* Only the fragment shader has no default float precision */
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
/* Desktop GLSL doesn't know about these */
|
||||
#define highp
|
||||
#define mediump
|
||||
#define lowp
|
||||
|
||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
uniform lowp float alpha;
|
||||
uniform float alpha;
|
||||
|
||||
varying lowp vec4 v_color;
|
||||
varying vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
uniform lowp vec4 color;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = color;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
|
||||
uniform sampler2D texture;
|
||||
uniform lowp float gray;
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
const vec3 lumaF = vec3(.299, .587, .114);
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Sample source color */
|
||||
vec4 frag = texture2D(texture, v_texCoord);
|
||||
|
||||
/* Apply gray */
|
||||
float luma = dot(frag.rgb, lumaF);
|
||||
frag.rgb = mix(frag.rgb, vec3(luma), gray);
|
||||
|
||||
gl_FragColor = frag;
|
||||
}
|
|
@ -1,40 +1,48 @@
|
|||
|
||||
uniform sampler2D texture;
|
||||
uniform mediump float hueAdjust;
|
||||
uniform sampler2D inputTexture;
|
||||
uniform float hueAdjust;
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
/* Source: gamedev.stackexchange.com/a/59808/24839 */
|
||||
vec3 rgb2hsv(vec3 c)
|
||||
{
|
||||
const vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
||||
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
||||
|
||||
float d = q.x - min(q.w, q.y);
|
||||
|
||||
/* Avoid divide-by-zero situations by adding a very tiny delta.
|
||||
* Since we always deal with underlying 8-Bit color values, this
|
||||
* should never mask a real value */
|
||||
const float eps = 1.0e-10;
|
||||
|
||||
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + eps)), d / (q.x + eps), q.x);
|
||||
}
|
||||
|
||||
vec3 hsv2rgb(vec3 c)
|
||||
{
|
||||
const vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
|
||||
void main ()
|
||||
{
|
||||
vec4 color = texture2D (texture, v_texCoord.xy);
|
||||
vec3 hsv = rgb2hsv(color.rgb);
|
||||
const vec4 kRGBToYPrime = vec4 (0.299, 0.587, 0.114, 0.0);
|
||||
const vec4 kRGBToI = vec4 (0.596, -0.275, -0.321, 0.0);
|
||||
const vec4 kRGBToQ = vec4 (0.212, -0.523, 0.311, 0.0);
|
||||
|
||||
hsv.x += hueAdjust;
|
||||
color.rgb = hsv2rgb(hsv);
|
||||
const vec4 kYIQToR = vec4 (1.0, 0.956, 0.621, 0.0);
|
||||
const vec4 kYIQToG = vec4 (1.0, -0.272, -0.647, 0.0);
|
||||
const vec4 kYIQToB = vec4 (1.0, -1.107, 1.704, 0.0);
|
||||
|
||||
gl_FragColor = color;
|
||||
/* Sample the input pixel */
|
||||
vec4 color = texture2D (inputTexture, v_texCoord.xy);
|
||||
|
||||
/* Convert to YIQ */
|
||||
float YPrime = dot (color, kRGBToYPrime);
|
||||
float I = dot (color, kRGBToI);
|
||||
float Q = dot (color, kRGBToQ);
|
||||
|
||||
/* Calculate the hue and chroma */
|
||||
float hue = atan (Q, I);
|
||||
float chroma = sqrt (I * I + Q * Q);
|
||||
|
||||
/* Make the user's adjustments */
|
||||
hue += hueAdjust;
|
||||
|
||||
/* Remember old I and color */
|
||||
float IOriginal = I;
|
||||
vec4 coOriginal = color;
|
||||
|
||||
/* Convert back to YIQ */
|
||||
Q = chroma * sin (hue);
|
||||
I = chroma * cos (hue);
|
||||
|
||||
/* Convert back to RGB */
|
||||
vec4 yIQ = vec4 (YPrime, I, Q, 0.0);
|
||||
color.r = dot (yIQ, kYIQToR);
|
||||
color.g = dot (yIQ, kYIQToG);
|
||||
color.b = dot (yIQ, kYIQToB);
|
||||
|
||||
/* Save the result */
|
||||
gl_FragColor = (IOriginal == 0.0) ? coOriginal : color;
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
uniform mat4 projMat;
|
||||
attribute vec2 position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = projMat * vec4(position, 0, 1);
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
uniform sampler2D texture;
|
||||
|
||||
uniform lowp vec4 tone;
|
||||
uniform vec4 tone;
|
||||
|
||||
uniform lowp float opacity;
|
||||
uniform lowp vec4 color;
|
||||
uniform lowp vec4 flash;
|
||||
uniform float opacity;
|
||||
uniform vec4 color;
|
||||
uniform vec4 flash;
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
uniform sampler2D texture;
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
varying lowp vec4 v_color;
|
||||
varying vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
|
||||
uniform sampler2D texture;
|
||||
uniform lowp float alpha;
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = texture2D(texture, v_texCoord);
|
||||
gl_FragColor.a *= alpha;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
varying lowp vec4 v_color;
|
||||
varying vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -6,10 +6,10 @@ uniform vec2 translation;
|
|||
|
||||
attribute vec2 position;
|
||||
attribute vec2 texCoord;
|
||||
attribute lowp vec4 color;
|
||||
attribute vec4 color;
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
varying lowp vec4 v_color;
|
||||
varying vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -6,10 +6,10 @@ uniform vec2 texSizeInv;
|
|||
|
||||
attribute vec2 position;
|
||||
attribute vec2 texCoord;
|
||||
attribute lowp vec4 color;
|
||||
attribute vec4 color;
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
varying lowp vec4 v_color;
|
||||
varying vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
|
||||
uniform sampler2D texture;
|
||||
|
||||
uniform lowp vec4 tone;
|
||||
uniform vec4 tone;
|
||||
|
||||
uniform lowp float opacity;
|
||||
uniform lowp vec4 color;
|
||||
uniform float opacity;
|
||||
uniform vec4 color;
|
||||
|
||||
uniform float bushDepth;
|
||||
uniform lowp float bushOpacity;
|
||||
uniform float bushOpacity;
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
|
@ -32,7 +32,7 @@ void main()
|
|||
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
||||
|
||||
/* Apply bush alpha by mathematical if */
|
||||
lowp float underBush = float(v_texCoord.y < bushDepth);
|
||||
float underBush = float(v_texCoord.y < bushDepth);
|
||||
frag.a *= clamp(bushOpacity + underBush, 0.0, 1.0);
|
||||
|
||||
gl_FragColor = frag;
|
||||
|
|
|
@ -18,9 +18,8 @@ const float atAniOffset = 32.0*3.0;
|
|||
void main()
|
||||
{
|
||||
vec2 tex = texCoord;
|
||||
|
||||
lowp float pred = float(tex.x <= atAreaW && tex.y <= atAreaH);
|
||||
tex.x += aniIndex * atAniOffset * pred;
|
||||
if (tex.x <= atAreaW && tex.y <= atAreaH)
|
||||
tex.x += aniIndex * atAniOffset;
|
||||
|
||||
gl_Position = projMat * vec4(position + translation, 0, 1);
|
||||
|
||||
|
|
|
@ -18,15 +18,14 @@ const float atAreaCW = 4.0*32.0;
|
|||
void main()
|
||||
{
|
||||
vec2 tex = texCoord;
|
||||
lowp float pred;
|
||||
|
||||
/* Type A autotiles shift horizontally */
|
||||
pred = float(tex.x <= atAreaA.x && tex.y <= atAreaA.y);
|
||||
tex.x += aniOffset.x * pred;
|
||||
if (tex.x <= atAreaA.x && tex.y <= atAreaA.y)
|
||||
tex.x += aniOffset.x;
|
||||
|
||||
/* Type C autotiles shift vertically */
|
||||
pred = float(tex.x >= atAreaCX && tex.x <= (atAreaCX+atAreaCW) && tex.y <= atAreaA.y);
|
||||
tex.y += aniOffset.y * pred;
|
||||
if (tex.x >= atAreaCX && tex.x <= (atAreaCX+atAreaCW) && tex.y <= atAreaA.y)
|
||||
tex.y += aniOffset.y;
|
||||
|
||||
gl_Position = projMat * vec4(position + translation, 0, 1);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ void main()
|
|||
{
|
||||
float transV = texture2D(transMap, v_texCoord).r;
|
||||
float cTransV = clamp(transV, prog, prog+vague);
|
||||
lowp float alpha = (cTransV - prog) / vague;
|
||||
float alpha = (cTransV - prog) / vague;
|
||||
|
||||
vec4 newFrag = texture2D(currentScene, v_texCoord);
|
||||
vec4 oldFrag = texture2D(frozenScene, v_texCoord);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -238,6 +238,5 @@ inline ALenum chooseALFormat(int sampleSize, int channelCount)
|
|||
|
||||
#define AUDIO_SLEEP 10
|
||||
#define STREAM_BUF_SIZE 32768
|
||||
#define GLOBAL_VOLUME 0.8f
|
||||
|
||||
#endif // ALUTIL_H
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
105
src/alstream.cpp
105
src/alstream.cpp
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -23,13 +23,10 @@
|
|||
|
||||
#include "sharedstate.h"
|
||||
#include "sharedmidistate.h"
|
||||
#include "eventthread.h"
|
||||
#include "filesystem.h"
|
||||
#include "exception.h"
|
||||
#include "aldatasource.h"
|
||||
#include "fluid-fun.h"
|
||||
#include "sdl-util.h"
|
||||
#include "debugwriter.h"
|
||||
|
||||
#include <SDL_mutex.h>
|
||||
#include <SDL_thread.h>
|
||||
|
@ -42,12 +39,12 @@ ALStream::ALStream(LoopMode loopMode,
|
|||
source(0),
|
||||
thread(0),
|
||||
preemptPause(false),
|
||||
pitch(1.0f)
|
||||
pitch(1.0)
|
||||
{
|
||||
alSrc = AL::Source::gen();
|
||||
|
||||
AL::Source::setVolume(alSrc, 1.0f);
|
||||
AL::Source::setPitch(alSrc, 1.0f);
|
||||
AL::Source::setVolume(alSrc, 1.0);
|
||||
AL::Source::setPitch(alSrc, 1.0);
|
||||
AL::Source::detachBuffer(alSrc);
|
||||
|
||||
for (int i = 0; i < STREAM_BUFS; ++i)
|
||||
|
@ -125,9 +122,6 @@ void ALStream::stop()
|
|||
|
||||
void ALStream::play(float offset)
|
||||
{
|
||||
if (!source)
|
||||
return;
|
||||
|
||||
checkStopped();
|
||||
|
||||
switch (state)
|
||||
|
@ -172,7 +166,7 @@ void ALStream::setPitch(float value)
|
|||
/* If the source supports setting pitch natively,
|
||||
* we don't have to do it via OpenAL */
|
||||
if (source && source->setPitch(value))
|
||||
AL::Source::setPitch(alSrc, 1.0f);
|
||||
AL::Source::setPitch(alSrc, 1.0);
|
||||
else
|
||||
AL::Source::setPitch(alSrc, value);
|
||||
}
|
||||
|
@ -199,76 +193,35 @@ void ALStream::closeSource()
|
|||
delete source;
|
||||
}
|
||||
|
||||
struct ALStreamOpenHandler : FileSystem::OpenHandler
|
||||
{
|
||||
SDL_RWops *srcOps;
|
||||
bool looped;
|
||||
ALDataSource *source;
|
||||
std::string errorMsg;
|
||||
|
||||
ALStreamOpenHandler(SDL_RWops &srcOps, bool looped)
|
||||
: srcOps(&srcOps), looped(looped), source(0)
|
||||
{}
|
||||
|
||||
bool tryRead(SDL_RWops &ops, const char *ext)
|
||||
{
|
||||
/* Copy this because we need to keep it around,
|
||||
* as we will continue reading data from it later */
|
||||
*srcOps = ops;
|
||||
|
||||
/* Try to read ogg file signature */
|
||||
char sig[5] = { 0 };
|
||||
SDL_RWread(srcOps, sig, 1, 4);
|
||||
SDL_RWseek(srcOps, 0, RW_SEEK_SET);
|
||||
|
||||
try
|
||||
{
|
||||
if (!strcmp(sig, "OggS"))
|
||||
{
|
||||
source = createVorbisSource(*srcOps, looped);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!strcmp(sig, "MThd"))
|
||||
{
|
||||
shState->midiState().initIfNeeded(shState->config());
|
||||
|
||||
if (HAVE_FLUID)
|
||||
{
|
||||
source = createMidiSource(*srcOps, looped);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
source = createSDLSource(*srcOps, ext, STREAM_BUF_SIZE, looped);
|
||||
}
|
||||
catch (const Exception &e)
|
||||
{
|
||||
/* All source constructors will close the passed ops
|
||||
* before throwing errors */
|
||||
errorMsg = e.msg;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void ALStream::openSource(const std::string &filename)
|
||||
{
|
||||
ALStreamOpenHandler handler(srcOps, looped);
|
||||
shState->fileSystem().openRead(handler, filename.c_str());
|
||||
source = handler.source;
|
||||
const char *ext;
|
||||
shState->fileSystem().openRead(srcOps, filename.c_str(), FileSystem::Audio, false, &ext);
|
||||
needsRewind.clear();
|
||||
|
||||
if (!source)
|
||||
{
|
||||
char buf[512];
|
||||
snprintf(buf, sizeof(buf), "Unable to decode audio stream: %s: %s",
|
||||
filename.c_str(), handler.errorMsg.c_str());
|
||||
/* Try to read ogg file signature */
|
||||
char sig[5] = { 0 };
|
||||
SDL_RWread(&srcOps, sig, 1, 4);
|
||||
SDL_RWseek(&srcOps, 0, RW_SEEK_SET);
|
||||
|
||||
Debug() << buf;
|
||||
if (!strcmp(sig, "OggS"))
|
||||
{
|
||||
source = createVorbisSource(srcOps, looped);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(sig, "MThd"))
|
||||
{
|
||||
shState->midiState().initIfNeeded(shState->config());
|
||||
|
||||
if (HAVE_FLUID)
|
||||
{
|
||||
source = createMidiSource(srcOps, looped);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
source = createSDLSource(srcOps, ext, STREAM_BUF_SIZE, looped);
|
||||
}
|
||||
|
||||
void ALStream::stopStream()
|
||||
|
@ -408,8 +361,6 @@ void ALStream::streamData()
|
|||
* refill and queue them up again */
|
||||
while (true)
|
||||
{
|
||||
shState->rtData().syncPoint.passSecondarySync();
|
||||
|
||||
ALint procBufs = AL::Source::getProcBufferCount(alSrc);
|
||||
|
||||
while (procBufs--)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -25,7 +25,6 @@
|
|||
#include "soundemitter.h"
|
||||
#include "sharedstate.h"
|
||||
#include "sharedmidistate.h"
|
||||
#include "eventthread.h"
|
||||
#include "sdl-util.h"
|
||||
|
||||
#include <string>
|
||||
|
@ -41,8 +40,6 @@ struct AudioPrivate
|
|||
|
||||
SoundEmitter se;
|
||||
|
||||
SyncPoint &syncPoint;
|
||||
|
||||
/* The 'MeWatch' is responsible for detecting
|
||||
* a playing ME, quickly fading out the BGM and
|
||||
* keeping it paused/stopped while the ME plays,
|
||||
|
@ -63,12 +60,11 @@ struct AudioPrivate
|
|||
MeWatchState state;
|
||||
} meWatch;
|
||||
|
||||
AudioPrivate(RGSSThreadData &rtData)
|
||||
AudioPrivate(const Config &conf)
|
||||
: bgm(ALStream::Looped, "bgm"),
|
||||
bgs(ALStream::Looped, "bgs"),
|
||||
me(ALStream::NotLooped, "me"),
|
||||
se(rtData.config),
|
||||
syncPoint(rtData.syncPoint)
|
||||
se(conf)
|
||||
{
|
||||
meWatch.state = MeNotPlaying;
|
||||
meWatch.thread = createSDLThread
|
||||
|
@ -88,8 +84,6 @@ struct AudioPrivate
|
|||
|
||||
while (true)
|
||||
{
|
||||
syncPoint.passSecondarySync();
|
||||
|
||||
if (meWatch.termReq)
|
||||
return;
|
||||
|
||||
|
@ -170,7 +164,7 @@ struct AudioPrivate
|
|||
else
|
||||
{
|
||||
/* BGM is stopped. -> MeNotPlaying */
|
||||
bgm.setVolume(AudioStream::External, 1.0f);
|
||||
bgm.setVolume(AudioStream::External, 1.0);
|
||||
|
||||
if (!bgm.noResumeStop)
|
||||
bgm.stream.play();
|
||||
|
@ -193,7 +187,7 @@ struct AudioPrivate
|
|||
if (bgm.stream.queryState() == ALStream::Stopped)
|
||||
{
|
||||
/* BGM stopped midway fade in. -> MeNotPlaying */
|
||||
bgm.setVolume(AudioStream::External, 1.0f);
|
||||
bgm.setVolume(AudioStream::External, 1.0);
|
||||
meWatch.state = MeNotPlaying;
|
||||
bgm.unlockStream();
|
||||
|
||||
|
@ -219,7 +213,7 @@ struct AudioPrivate
|
|||
if (vol >= 1)
|
||||
{
|
||||
/* BGM fully faded in. -> MeNotPlaying */
|
||||
vol = 1.0f;
|
||||
vol = 1.0;
|
||||
meWatch.state = MeNotPlaying;
|
||||
}
|
||||
|
||||
|
@ -237,8 +231,8 @@ struct AudioPrivate
|
|||
}
|
||||
};
|
||||
|
||||
Audio::Audio(RGSSThreadData &rtData)
|
||||
: p(new AudioPrivate(rtData))
|
||||
Audio::Audio(const Config &conf)
|
||||
: p(new AudioPrivate(conf))
|
||||
{}
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,7 +33,7 @@
|
|||
* quite make out their meaning yet) */
|
||||
|
||||
struct AudioPrivate;
|
||||
struct RGSSThreadData;
|
||||
struct Config;
|
||||
|
||||
class Audio
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
void reset();
|
||||
|
||||
private:
|
||||
Audio(RGSSThreadData &rtData);
|
||||
Audio(const Config &conf);
|
||||
~Audio();
|
||||
|
||||
friend struct SharedStatePrivate;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -34,11 +34,11 @@ AudioStream::AudioStream(ALStream::LoopMode loopMode,
|
|||
noResumeStop(false),
|
||||
stream(loopMode, threadId)
|
||||
{
|
||||
current.volume = 1.0f;
|
||||
current.pitch = 1.0f;
|
||||
current.volume = 1.0;
|
||||
current.pitch = 1.0;
|
||||
|
||||
for (size_t i = 0; i < VolumeTypeCount; ++i)
|
||||
volumes[i] = 1.0f;
|
||||
volumes[i] = 1.0;
|
||||
|
||||
fade.thread = 0;
|
||||
fade.threadName = std::string("audio_fadeout (") + threadId + ")";
|
||||
|
@ -82,8 +82,8 @@ void AudioStream::play(const std::string &filename,
|
|||
|
||||
lockStream();
|
||||
|
||||
float _volume = clamp<int>(volume, 0, 100) / 100.0f;
|
||||
float _pitch = clamp<int>(pitch, 50, 150) / 100.0f;
|
||||
float _volume = clamp<int>(volume, 0, 100) / 100.f;
|
||||
float _pitch = clamp<int>(pitch, 50, 150) / 100.f;
|
||||
|
||||
ALStream::State sState = stream.queryState();
|
||||
|
||||
|
@ -179,7 +179,6 @@ void AudioStream::fadeOut(int duration)
|
|||
lockStream();
|
||||
|
||||
ALStream::State sState = stream.queryState();
|
||||
noResumeStop = true;
|
||||
|
||||
if (fade.active)
|
||||
{
|
||||
|
@ -211,7 +210,7 @@ void AudioStream::fadeOut(int duration)
|
|||
}
|
||||
|
||||
fade.active.set();
|
||||
fade.msStep = 1.0f / duration;
|
||||
fade.msStep = (1.0) / duration;
|
||||
fade.reqFini.clear();
|
||||
fade.reqTerm.clear();
|
||||
fade.startTicks = SDL_GetTicks();
|
||||
|
@ -253,7 +252,7 @@ float AudioStream::playingOffset()
|
|||
|
||||
void AudioStream::updateVolume()
|
||||
{
|
||||
float vol = GLOBAL_VOLUME;
|
||||
float vol = 1.0;
|
||||
|
||||
for (size_t i = 0; i < VolumeTypeCount; ++i)
|
||||
vol *= volumes[i];
|
||||
|
@ -302,7 +301,7 @@ void AudioStream::fadeOutThread()
|
|||
lockStream();
|
||||
|
||||
uint32_t curDur = SDL_GetTicks() - fade.startTicks;
|
||||
float resVol = 1.0f - (curDur*fade.msStep);
|
||||
float resVol = 1.0 - (curDur*fade.msStep);
|
||||
|
||||
ALStream::State state = stream.queryState();
|
||||
|
||||
|
@ -313,7 +312,7 @@ void AudioStream::fadeOutThread()
|
|||
if (state != ALStream::Paused)
|
||||
stream.stop();
|
||||
|
||||
setVolume(FadeOut, 1.0f);
|
||||
setVolume(FadeOut, 1.0);
|
||||
unlockStream();
|
||||
|
||||
break;
|
||||
|
@ -340,15 +339,15 @@ void AudioStream::fadeInThread()
|
|||
|
||||
/* Fade in duration is always 1 second */
|
||||
uint32_t cur = SDL_GetTicks() - fadeIn.startTicks;
|
||||
float prog = cur / 1000.0f;
|
||||
float prog = cur / 1000.0;
|
||||
|
||||
ALStream::State state = stream.queryState();
|
||||
|
||||
if (state != ALStream::Playing
|
||||
|| prog >= 1.0f
|
||||
|| prog >= 1.0
|
||||
|| fadeIn.rqFini)
|
||||
{
|
||||
setVolume(FadeIn, 1.0f);
|
||||
setVolume(FadeIn, 1.0);
|
||||
unlockStream();
|
||||
|
||||
break;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -55,10 +55,7 @@ struct AudioStream
|
|||
|
||||
/* Note that 'extPaused' and 'noResumeStop' are
|
||||
* effectively only used with the AudioStream
|
||||
* instance representing the BGM.
|
||||
* They are not AtomicFlags because they're regarded
|
||||
* as part of the underlying stream state, and
|
||||
* always accessed with the stream lock held */
|
||||
* instance representing the BGM */
|
||||
|
||||
/* Flag indicating that the MeWatch paused this
|
||||
* (BGM) stream because a ME started playing.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
136
src/bitmap.cpp
136
src/bitmap.cpp
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -221,9 +221,9 @@ struct BitmapPrivate
|
|||
surf = surfConv;
|
||||
}
|
||||
|
||||
void onModified(bool freeSurface = true)
|
||||
void onModified()
|
||||
{
|
||||
if (surface && freeSurface)
|
||||
if (surface)
|
||||
{
|
||||
SDL_FreeSurface(surface);
|
||||
surface = 0;
|
||||
|
@ -233,26 +233,12 @@ struct BitmapPrivate
|
|||
}
|
||||
};
|
||||
|
||||
struct BitmapOpenHandler : FileSystem::OpenHandler
|
||||
{
|
||||
SDL_Surface *surf;
|
||||
|
||||
BitmapOpenHandler()
|
||||
: surf(0)
|
||||
{}
|
||||
|
||||
bool tryRead(SDL_RWops &ops, const char *ext)
|
||||
{
|
||||
surf = IMG_LoadTyped_RW(&ops, 1, ext);
|
||||
return surf != 0;
|
||||
}
|
||||
};
|
||||
|
||||
Bitmap::Bitmap(const char *filename)
|
||||
{
|
||||
BitmapOpenHandler handler;
|
||||
shState->fileSystem().openRead(handler, filename);
|
||||
SDL_Surface *imgSurf = handler.surf;
|
||||
SDL_RWops ops;
|
||||
const char *extension;
|
||||
shState->fileSystem().openRead(ops, filename, FileSystem::Image, false, &extension);
|
||||
SDL_Surface *imgSurf = IMG_LoadTyped_RW(&ops, 1, extension);
|
||||
|
||||
if (!imgSurf)
|
||||
throw Exception(Exception::SDLError, "Error loading image '%s': %s",
|
||||
|
@ -265,7 +251,6 @@ Bitmap::Bitmap(const char *filename)
|
|||
/* Mega surface */
|
||||
p = new BitmapPrivate(this);
|
||||
p->megaSurface = imgSurf;
|
||||
SDL_SetSurfaceBlendMode(p->megaSurface, SDL_BLENDMODE_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -389,46 +374,14 @@ void Bitmap::stretchBlt(const IntRect &destRect,
|
|||
if (opacity == 0)
|
||||
return;
|
||||
|
||||
SDL_Surface *srcSurf = source.megaSurface();
|
||||
|
||||
if (srcSurf && shState->config().subImageFix)
|
||||
if (source.megaSurface())
|
||||
{
|
||||
/* Blit from software surface, for broken GL drivers */
|
||||
Vec2i gpTexSize;
|
||||
shState->ensureTexSize(sourceRect.w, sourceRect.h, gpTexSize);
|
||||
shState->bindTex();
|
||||
|
||||
GLMeta::subRectImageUpload(srcSurf->w, sourceRect.x, sourceRect.y, 0, 0,
|
||||
sourceRect.w, sourceRect.h, srcSurf, GL_RGBA);
|
||||
GLMeta::subRectImageEnd();
|
||||
|
||||
SimpleShader &shader = shState->shaders().simple;
|
||||
shader.bind();
|
||||
shader.setTranslation(Vec2i());
|
||||
shader.setTexSize(gpTexSize);
|
||||
|
||||
p->pushSetViewport(shader);
|
||||
p->bindFBO();
|
||||
|
||||
Quad &quad = shState->gpQuad();
|
||||
quad.setTexRect(FloatRect(0, 0, sourceRect.w, sourceRect.h));
|
||||
quad.setPosRect(destRect);
|
||||
|
||||
p->blitQuad(quad);
|
||||
p->popViewport();
|
||||
|
||||
p->addTaintedArea(destRect);
|
||||
p->onModified();
|
||||
|
||||
return;
|
||||
}
|
||||
else if (srcSurf)
|
||||
{
|
||||
/* Blit from software surface */
|
||||
/* Don't do transparent blits for now */
|
||||
if (opacity < 255)
|
||||
source.ensureNonMega();
|
||||
|
||||
SDL_Surface *srcSurf = source.megaSurface();
|
||||
|
||||
SDL_Rect srcRect = sourceRect;
|
||||
SDL_Rect dstRect = destRect;
|
||||
SDL_Rect btmRect = { 0, 0, width(), height() };
|
||||
|
@ -444,25 +397,26 @@ void Bitmap::stretchBlt(const IntRect &destRect,
|
|||
SDL_Surface *blitTemp =
|
||||
SDL_CreateRGBSurface(0, destRect.w, destRect.h, bpp, rMask, gMask, bMask, aMask);
|
||||
|
||||
SDL_BlitScaled(srcSurf, &srcRect, blitTemp, 0);
|
||||
// FXIME: This is supposed to be a scaled blit, put SDL2 for some reason
|
||||
// makes the source surface unusable after BlitScaled() is called. Investigate!
|
||||
SDL_BlitSurface(srcSurf, &srcRect, blitTemp, 0);
|
||||
|
||||
TEX::bind(p->gl.tex);
|
||||
|
||||
if (bltRect.w == dstRect.w && bltRect.h == dstRect.h)
|
||||
{
|
||||
/* Dest rectangle lies within bounding box */
|
||||
TEX::uploadSubImage(destRect.x, destRect.y,
|
||||
destRect.w, destRect.h,
|
||||
blitTemp->pixels, GL_RGBA);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Clipped blit */
|
||||
GLMeta::subRectImageUpload(blitTemp->w, bltRect.x - dstRect.x, bltRect.y - dstRect.y,
|
||||
bltRect.x, bltRect.y, bltRect.w, bltRect.h, blitTemp, GL_RGBA);
|
||||
GLMeta::subRectImageEnd();
|
||||
}
|
||||
|
||||
|
||||
SDL_FreeSurface(blitTemp);
|
||||
|
||||
p->onModified();
|
||||
|
@ -514,6 +468,7 @@ void Bitmap::stretchBlt(const IntRect &destRect,
|
|||
}
|
||||
|
||||
p->addTaintedArea(destRect);
|
||||
|
||||
p->onModified();
|
||||
}
|
||||
|
||||
|
@ -768,14 +723,6 @@ void Bitmap::clear()
|
|||
p->onModified();
|
||||
}
|
||||
|
||||
static uint32_t &getPixelAt(SDL_Surface *surf, SDL_PixelFormat *form, int x, int y)
|
||||
{
|
||||
size_t offset = x*form->BytesPerPixel + y*surf->pitch;
|
||||
uint8_t *bytes = (uint8_t*) surf->pixels + offset;
|
||||
|
||||
return *((uint32_t*) bytes);
|
||||
}
|
||||
|
||||
Color Bitmap::getPixel(int x, int y) const
|
||||
{
|
||||
guardDisposed();
|
||||
|
@ -798,7 +745,9 @@ Color Bitmap::getPixel(int x, int y) const
|
|||
glState.viewport.pop();
|
||||
}
|
||||
|
||||
uint32_t pixel = getPixelAt(p->surface, p->format, x, y);
|
||||
size_t offset = x*p->format->BytesPerPixel + y*p->surface->pitch;
|
||||
uint8_t *bytes = (uint8_t*) p->surface->pixels + offset;
|
||||
uint32_t pixel = *((uint32_t*) bytes);
|
||||
|
||||
return Color((pixel >> p->format->Rshift) & 0xFF,
|
||||
(pixel >> p->format->Gshift) & 0xFF,
|
||||
|
@ -825,16 +774,7 @@ void Bitmap::setPixel(int x, int y, const Color &color)
|
|||
|
||||
p->addTaintedArea(IntRect(x, y, 1, 1));
|
||||
|
||||
/* Setting just a single pixel is no reason to throw away the
|
||||
* whole cached surface; we can just apply the same change */
|
||||
|
||||
if (p->surface)
|
||||
{
|
||||
uint32_t &surfPixel = getPixelAt(p->surface, p->format, x, y);
|
||||
surfPixel = SDL_MapRGBA(p->format, pixel[0], pixel[1], pixel[2], pixel[3]);
|
||||
}
|
||||
|
||||
p->onModified(false);
|
||||
p->onModified();
|
||||
}
|
||||
|
||||
void Bitmap::hueChange(int hue)
|
||||
|
@ -854,10 +794,13 @@ void Bitmap::hueChange(int hue)
|
|||
quad.setTexPosRect(texRect, texRect);
|
||||
quad.setColor(Vec4(1, 1, 1, 1));
|
||||
|
||||
/* Calculate hue parameter */
|
||||
hue = wrapRange(hue, 0, 359);
|
||||
float hueAdj = -((M_PI * 2) / 360) * hue;
|
||||
|
||||
HueShader &shader = shState->shaders().hue;
|
||||
shader.bind();
|
||||
/* Shader expects normalized value */
|
||||
shader.setHueAdjust(wrapRange(hue, 0, 359) / 360.0f);
|
||||
shader.setHueAdjust(hueAdj);
|
||||
|
||||
FBO::bind(newTex.fbo);
|
||||
p->pushSetViewport(shader);
|
||||
|
@ -902,9 +845,9 @@ static void applyShadow(SDL_Surface *&in, const SDL_PixelFormat &fm, const SDL_C
|
|||
SDL_Surface *out = SDL_CreateRGBSurface
|
||||
(0, in->w+1, in->h+1, fm.BitsPerPixel, fm.Rmask, fm.Gmask, fm.Bmask, fm.Amask);
|
||||
|
||||
float fr = c.r / 255.0f;
|
||||
float fg = c.g / 255.0f;
|
||||
float fb = c.b / 255.0f;
|
||||
float fr = c.r / 255.0;
|
||||
float fg = c.g / 255.0;
|
||||
float fb = c.b / 255.0;
|
||||
|
||||
/* We allocate an output surface one pixel wider and higher than the input,
|
||||
* (implicitly) blit a copy of the input with RGB values set to black into
|
||||
|
@ -958,11 +901,11 @@ static void applyShadow(SDL_Surface *&in, const SDL_PixelFormat &fm, const SDL_C
|
|||
continue;
|
||||
}
|
||||
|
||||
float fSrcA = srcA / 255.0f;
|
||||
float fShdA = shdA / 255.0f;
|
||||
float fSrcA = srcA / 255.0;
|
||||
float fShdA = shdA / 255.0;
|
||||
|
||||
/* Because opacity == 1, co1 == fSrcA */
|
||||
float co2 = fShdA * (1.0f - fSrcA);
|
||||
float co2 = fShdA * (1.0 - fSrcA);
|
||||
/* Result alpha */
|
||||
float fa = fSrcA + co2;
|
||||
/* Temp value to simplify arithmetic below */
|
||||
|
@ -971,10 +914,10 @@ static void applyShadow(SDL_Surface *&in, const SDL_PixelFormat &fm, const SDL_C
|
|||
/* Result colors */
|
||||
uint8_t r, g, b, a;
|
||||
|
||||
r = clamp<float>(fr * co3, 0, 1) * 255.0f;
|
||||
g = clamp<float>(fg * co3, 0, 1) * 255.0f;
|
||||
b = clamp<float>(fb * co3, 0, 1) * 255.0f;
|
||||
a = clamp<float>(fa, 0, 1) * 255.0f;
|
||||
r = clamp<float>(fr * co3, 0, 1) * 255;
|
||||
g = clamp<float>(fg * co3, 0, 1) * 255;
|
||||
b = clamp<float>(fb * co3, 0, 1) * 255;
|
||||
a = clamp<float>(fa, 0, 1) * 255;
|
||||
|
||||
*outP = SDL_MapRGBA(&fm, r, g, b, a);
|
||||
}
|
||||
|
@ -1017,15 +960,12 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
|||
|
||||
p->ensureFormat(txtSurf, SDL_PIXELFORMAT_ABGR8888);
|
||||
|
||||
int rawTxtSurfH = txtSurf->h;
|
||||
|
||||
if (p->font->getShadow())
|
||||
applyShadow(txtSurf, *p->format, c);
|
||||
|
||||
/* outline using TTF_Outline and blending it together with SDL_BlitSurface
|
||||
* FIXME: outline is forced to have the same opacity as the font color */
|
||||
if (p->font->getOutline())
|
||||
{
|
||||
if (p->font->getOutline()) {
|
||||
SDL_Color co = outColor.toSDLColor();
|
||||
co.a = 255;
|
||||
SDL_Surface *outline;
|
||||
|
@ -1067,7 +1007,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
|||
if (alignX < rect.x)
|
||||
alignX = rect.x;
|
||||
|
||||
int alignY = rect.y + (rect.h - rawTxtSurfH) / 2;
|
||||
int alignY = rect.y + (rect.h - txtSurf->h) / 2;
|
||||
|
||||
float squeeze = (float) rect.w / txtSurf->w;
|
||||
|
||||
|
@ -1079,11 +1019,11 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
|||
Vec2i gpTexSize;
|
||||
shState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize);
|
||||
|
||||
bool fastBlit = !p->touchesTaintedArea(posRect) && txtAlpha == 1.0f;
|
||||
bool fastBlit = !p->touchesTaintedArea(posRect) && txtAlpha == 1.0;
|
||||
|
||||
if (fastBlit)
|
||||
{
|
||||
if (squeeze == 1.0f && !shState->config().subImageFix)
|
||||
if (squeeze == 1.0)
|
||||
{
|
||||
/* Even faster: upload directly to bitmap texture.
|
||||
* We have to make sure the posRect lies within the texture
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
178
src/config.cpp
178
src/config.cpp
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,8 +32,6 @@
|
|||
|
||||
#include "debugwriter.h"
|
||||
#include "util.h"
|
||||
#include "sdl-util.h"
|
||||
#include "iniconfig.h"
|
||||
|
||||
#ifdef INI_ENCODING
|
||||
extern "C" {
|
||||
|
@ -125,93 +123,77 @@ static bool validUtf8(const char *string)
|
|||
static std::string prefPath(const char *org, const char *app)
|
||||
{
|
||||
char *path = SDL_GetPrefPath(org, app);
|
||||
|
||||
if (!path)
|
||||
return std::string();
|
||||
|
||||
std::string str(path);
|
||||
SDL_free(path);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::set<T> setFromVec(const std::vector<T> &vec)
|
||||
{
|
||||
return std::set<T>(vec.begin(), vec.end());
|
||||
}
|
||||
|
||||
typedef std::vector<std::string> StringVec;
|
||||
namespace po = boost::program_options;
|
||||
|
||||
#define CONF_FILE "mkxp.conf"
|
||||
|
||||
Config::Config()
|
||||
{}
|
||||
: rgssVersion(0),
|
||||
debugMode(false),
|
||||
winResizable(false),
|
||||
fullscreen(false),
|
||||
fixedAspectRatio(true),
|
||||
smoothScaling(false),
|
||||
vsync(false),
|
||||
defScreenW(0),
|
||||
defScreenH(0),
|
||||
fixedFramerate(0),
|
||||
frameSkip(true),
|
||||
solidFonts(false),
|
||||
gameFolder("."),
|
||||
anyAltToggleFS(false),
|
||||
enableReset(true),
|
||||
allowSymlinks(false),
|
||||
pathCache(true),
|
||||
useScriptNames(false)
|
||||
{
|
||||
midi.chorus = false;
|
||||
midi.reverb = false;
|
||||
SE.sourceCount = 6;
|
||||
}
|
||||
|
||||
void Config::read(int argc, char *argv[])
|
||||
{
|
||||
#define PO_DESC_ALL \
|
||||
PO_DESC(rgssVersion, int, 0) \
|
||||
PO_DESC(debugMode, bool, false) \
|
||||
PO_DESC(printFPS, bool, false) \
|
||||
PO_DESC(winResizable, bool, false) \
|
||||
PO_DESC(fullscreen, bool, false) \
|
||||
PO_DESC(fixedAspectRatio, bool, true) \
|
||||
PO_DESC(smoothScaling, bool, true) \
|
||||
PO_DESC(vsync, bool, false) \
|
||||
PO_DESC(defScreenW, int, 0) \
|
||||
PO_DESC(defScreenH, int, 0) \
|
||||
PO_DESC(windowTitle, std::string, "") \
|
||||
PO_DESC(fixedFramerate, int, 0) \
|
||||
PO_DESC(frameSkip, bool, true) \
|
||||
PO_DESC(syncToRefreshrate, bool, false) \
|
||||
PO_DESC(solidFonts, bool, false) \
|
||||
PO_DESC(subImageFix, bool, false) \
|
||||
PO_DESC(enableBlitting, bool, true) \
|
||||
PO_DESC(maxTextureSize, int, 0) \
|
||||
PO_DESC(gameFolder, std::string, ".") \
|
||||
PO_DESC(anyAltToggleFS, bool, false) \
|
||||
PO_DESC(enableReset, bool, true) \
|
||||
PO_DESC(allowSymlinks, bool, false) \
|
||||
PO_DESC(dataPathOrg, std::string, "") \
|
||||
PO_DESC(dataPathApp, std::string, "") \
|
||||
PO_DESC(iconPath, std::string, "") \
|
||||
PO_DESC(execName, std::string, "Game") \
|
||||
PO_DESC(titleLanguage, std::string, "") \
|
||||
PO_DESC(midi.soundFont, std::string, "") \
|
||||
PO_DESC(midi.chorus, bool, false) \
|
||||
PO_DESC(midi.reverb, bool, false) \
|
||||
PO_DESC(SE.sourceCount, int, 6) \
|
||||
PO_DESC(customScript, std::string, "") \
|
||||
PO_DESC(pathCache, bool, true) \
|
||||
PO_DESC(useScriptNames, bool, false)
|
||||
PO_DESC(rgssVersion, int) \
|
||||
PO_DESC(debugMode, bool) \
|
||||
PO_DESC(winResizable, bool) \
|
||||
PO_DESC(fullscreen, bool) \
|
||||
PO_DESC(fixedAspectRatio, bool) \
|
||||
PO_DESC(smoothScaling, bool) \
|
||||
PO_DESC(vsync, bool) \
|
||||
PO_DESC(defScreenW, int) \
|
||||
PO_DESC(defScreenH, int) \
|
||||
PO_DESC(fixedFramerate, int) \
|
||||
PO_DESC(frameSkip, bool) \
|
||||
PO_DESC(solidFonts, bool) \
|
||||
PO_DESC(gameFolder, std::string) \
|
||||
PO_DESC(anyAltToggleFS, bool) \
|
||||
PO_DESC(enableReset, bool) \
|
||||
PO_DESC(allowSymlinks, bool) \
|
||||
PO_DESC(dataPathOrg, std::string) \
|
||||
PO_DESC(dataPathApp, std::string) \
|
||||
PO_DESC(iconPath, std::string) \
|
||||
PO_DESC(titleLanguage, std::string) \
|
||||
PO_DESC(midi.soundFont, std::string) \
|
||||
PO_DESC(midi.chorus, bool) \
|
||||
PO_DESC(midi.reverb, bool) \
|
||||
PO_DESC(SE.sourceCount, int) \
|
||||
PO_DESC(customScript, std::string) \
|
||||
PO_DESC(pathCache, bool) \
|
||||
PO_DESC(useScriptNames, bool)
|
||||
|
||||
// Not gonna take your shit boost
|
||||
#define GUARD_ALL( exp ) try { exp } catch(...) {}
|
||||
|
||||
editor.debug = false;
|
||||
editor.battleTest = false;
|
||||
|
||||
/* Read arguments sent from the editor */
|
||||
if (argc > 1)
|
||||
{
|
||||
std::string argv1 = argv[1];
|
||||
/* RGSS1 uses "debug", 2 and 3 use "test" */
|
||||
if (argv1 == "debug" || argv1 == "test")
|
||||
editor.debug = true;
|
||||
else if (argv1 == "btest")
|
||||
editor.battleTest = true;
|
||||
|
||||
/* Fix offset */
|
||||
if (editor.debug || editor.battleTest)
|
||||
{
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
}
|
||||
|
||||
#define PO_DESC(key, type, def) (#key, po::value< type >()->default_value(def))
|
||||
#define PO_DESC(key, type) (#key, po::value< type >()->default_value(key))
|
||||
|
||||
po::options_description podesc;
|
||||
podesc.add_options()
|
||||
|
@ -237,27 +219,30 @@ void Config::read(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* Parse configuration file */
|
||||
SDLRWStream confFile(CONF_FILE, "r");
|
||||
std::ifstream confFile;
|
||||
confFile.open(CONF_FILE);
|
||||
|
||||
if (confFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
po::store(po::parse_config_file(confFile.stream(), podesc, true), vm);
|
||||
po::store(po::parse_config_file(confFile, podesc, true), vm);
|
||||
po::notify(vm);
|
||||
}
|
||||
catch (po::error &error)
|
||||
{
|
||||
Debug() << CONF_FILE":" << error.what();
|
||||
}
|
||||
|
||||
confFile.close();
|
||||
}
|
||||
|
||||
#undef PO_DESC
|
||||
#define PO_DESC(key, type, def) GUARD_ALL( key = vm[#key].as< type >(); )
|
||||
#define PO_DESC(key, type) GUARD_ALL( key = vm[#key].as< type >(); )
|
||||
|
||||
PO_DESC_ALL;
|
||||
|
||||
GUARD_ALL( preloadScripts = setFromVec(vm["preloadScript"].as<StringVec>()); );
|
||||
GUARD_ALL( preloadScripts = vm["preloadScript"].as<StringVec>(); );
|
||||
|
||||
GUARD_ALL( rtps = vm["RTP"].as<StringVec>(); );
|
||||
|
||||
|
@ -311,38 +296,27 @@ void Config::readGameINI()
|
|||
return;
|
||||
}
|
||||
|
||||
std::string iniFilename = execName + ".ini";
|
||||
SDLRWStream iniFile(iniFilename.c_str(), "r");
|
||||
po::options_description podesc;
|
||||
podesc.add_options()
|
||||
("Game.Title", po::value<std::string>())
|
||||
("Game.Scripts", po::value<std::string>())
|
||||
;
|
||||
|
||||
if (iniFile)
|
||||
{
|
||||
INIConfiguration ic;
|
||||
if(ic.load(iniFile.stream()))
|
||||
{
|
||||
GUARD_ALL( game.title = ic.getStringProperty("Game", "Title"); );
|
||||
GUARD_ALL( game.scripts = ic.getStringProperty("Game", "Scripts"); );
|
||||
std::string iniPath = gameFolder + "/Game.ini";
|
||||
|
||||
strReplace(game.scripts, '\\', '/');
|
||||
std::ifstream iniFile;
|
||||
iniFile.open((iniPath).c_str());
|
||||
|
||||
if (game.title.empty())
|
||||
{
|
||||
Debug() << iniFilename + ": Could not find Game.Title property";
|
||||
}
|
||||
po::variables_map vm;
|
||||
po::store(po::parse_config_file(iniFile, podesc, true), vm);
|
||||
po::notify(vm);
|
||||
|
||||
if (game.scripts.empty())
|
||||
{
|
||||
Debug() << iniFilename + ": Could not find Game.Scripts property";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug() << iniFilename + ": Failed to parse ini file";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug() << "FAILED to open" << iniFilename;
|
||||
}
|
||||
iniFile.close();
|
||||
|
||||
GUARD_ALL( game.title = vm["Game.Title"].as<std::string>(); );
|
||||
GUARD_ALL( game.scripts = vm["Game.Scripts"].as<std::string>(); );
|
||||
|
||||
strReplace(game.scripts, '\\', '/');
|
||||
|
||||
#ifdef INI_ENCODING
|
||||
/* Can add more later */
|
||||
|
|
19
src/config.h
19
src/config.h
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -24,14 +24,12 @@
|
|||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
struct Config
|
||||
{
|
||||
int rgssVersion;
|
||||
|
||||
bool debugMode;
|
||||
bool printFPS;
|
||||
|
||||
bool winResizable;
|
||||
bool fullscreen;
|
||||
|
@ -41,18 +39,12 @@ struct Config
|
|||
|
||||
int defScreenW;
|
||||
int defScreenH;
|
||||
std::string windowTitle;
|
||||
|
||||
int fixedFramerate;
|
||||
bool frameSkip;
|
||||
bool syncToRefreshrate;
|
||||
|
||||
bool solidFonts;
|
||||
|
||||
bool subImageFix;
|
||||
bool enableBlitting;
|
||||
int maxTextureSize;
|
||||
|
||||
std::string gameFolder;
|
||||
bool anyAltToggleFS;
|
||||
bool enableReset;
|
||||
|
@ -63,7 +55,6 @@ struct Config
|
|||
std::string dataPathApp;
|
||||
|
||||
std::string iconPath;
|
||||
std::string execName;
|
||||
std::string titleLanguage;
|
||||
|
||||
struct
|
||||
|
@ -81,19 +72,13 @@ struct Config
|
|||
bool useScriptNames;
|
||||
|
||||
std::string customScript;
|
||||
std::set<std::string> preloadScripts;
|
||||
std::vector<std::string> preloadScripts;
|
||||
std::vector<std::string> rtps;
|
||||
|
||||
std::vector<std::string> fontSubs;
|
||||
|
||||
std::vector<std::string> rubyLoadpaths;
|
||||
|
||||
/* Editor flags */
|
||||
struct {
|
||||
bool debug;
|
||||
bool battleTest;
|
||||
} editor;
|
||||
|
||||
/* Game INI contents */
|
||||
struct {
|
||||
std::string scripts;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,11 +26,6 @@
|
|||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* A cheap replacement for qDebug() */
|
||||
|
||||
class Debug
|
||||
|
@ -61,11 +56,7 @@ public:
|
|||
|
||||
~Debug()
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
__android_log_write(ANDROID_LOG_DEBUG, "mkxp", buf.str().c_str());
|
||||
#else
|
||||
std::cerr << buf.str() << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -60,11 +60,6 @@ struct Vec4
|
|||
{
|
||||
return (x == other.x && y == other.y && z == other.z && w == other.w);
|
||||
}
|
||||
|
||||
bool xyzNotNull() const
|
||||
{
|
||||
return (x != 0.0f || y != 0.0f || z != 0.0f);
|
||||
}
|
||||
};
|
||||
|
||||
struct Vec2i
|
||||
|
@ -79,78 +74,19 @@ struct Vec2i
|
|||
: x(x), y(y)
|
||||
{}
|
||||
|
||||
explicit Vec2i(int xy)
|
||||
: x(xy), y(xy)
|
||||
{}
|
||||
|
||||
bool operator==(const Vec2i &other) const
|
||||
{
|
||||
return x == other.x && y == other.y;
|
||||
}
|
||||
|
||||
bool operator!=(const Vec2i &other) const
|
||||
Vec2i &operator+=(const Vec2i &other)
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
Vec2i &operator+=(const Vec2i &value)
|
||||
{
|
||||
x += value.x;
|
||||
y += value.y;
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vec2i &operator-=(const Vec2i &value)
|
||||
{
|
||||
x -= value.x;
|
||||
y -= value.y;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vec2i operator+(const Vec2i &value) const
|
||||
{
|
||||
return Vec2i(x + value.x, y + value.y);
|
||||
}
|
||||
|
||||
Vec2i operator-(const Vec2i &value) const
|
||||
{
|
||||
return Vec2i(x - value.x, y - value.y);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Vec2i operator*(T value) const
|
||||
{
|
||||
return Vec2i(x * value, y * value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Vec2i operator/(T value) const
|
||||
{
|
||||
return Vec2i(x / value, y / value);
|
||||
}
|
||||
|
||||
Vec2i operator%(int value) const
|
||||
{
|
||||
return Vec2i(x % value, y % value);
|
||||
}
|
||||
|
||||
Vec2i operator&(unsigned value) const
|
||||
{
|
||||
return Vec2i(x & value, y & value);
|
||||
}
|
||||
|
||||
Vec2i operator-() const
|
||||
{
|
||||
return Vec2i(-x, -y);
|
||||
}
|
||||
|
||||
Vec2i operator!() const
|
||||
{
|
||||
return Vec2i(!x, !y);
|
||||
}
|
||||
|
||||
operator Vec2() const
|
||||
{
|
||||
return Vec2(x, y);
|
||||
|
@ -172,25 +108,12 @@ struct IntRect : SDL_Rect
|
|||
this->h = h;
|
||||
}
|
||||
|
||||
IntRect(const Vec2i &pos, const Vec2i &size)
|
||||
{
|
||||
x = pos.x;
|
||||
y = pos.y;
|
||||
w = size.x;
|
||||
h = size.y;
|
||||
}
|
||||
|
||||
bool operator==(const IntRect &other) const
|
||||
{
|
||||
return (x == other.x && y == other.y &&
|
||||
w == other.w && h == other.h);
|
||||
}
|
||||
|
||||
bool operator!=(const IntRect &other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
Vec2i pos() const
|
||||
{
|
||||
return Vec2i(x, y);
|
||||
|
@ -201,24 +124,10 @@ struct IntRect : SDL_Rect
|
|||
return Vec2i(w, h);
|
||||
}
|
||||
|
||||
void setPos(const Vec2i &value)
|
||||
operator SDL_Rect() const
|
||||
{
|
||||
x = value.x;
|
||||
y = value.y;
|
||||
}
|
||||
|
||||
void setSize(const Vec2i &value)
|
||||
{
|
||||
w = value.x;
|
||||
h = value.y;
|
||||
}
|
||||
|
||||
bool encloses(const IntRect &o) const
|
||||
{
|
||||
return (x <= o.x &&
|
||||
y <= o.y &&
|
||||
x+w >= o.x+o.w &&
|
||||
y+h >= o.y+o.h);
|
||||
SDL_Rect r = { x, y, w, h };
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -254,10 +163,35 @@ struct FloatRect
|
|||
Vec2 topRight() const { return Vec2(x+w, y); }
|
||||
Vec2 bottomRight() const { return Vec2(x+w, y+h); }
|
||||
|
||||
void shrinkHalf()
|
||||
{
|
||||
x += 0.5;
|
||||
y += 0.5;
|
||||
w -= 1.0;
|
||||
h -= 1.0;
|
||||
}
|
||||
|
||||
FloatRect vFlipped() const
|
||||
{
|
||||
return FloatRect(x, y+h, w, -h);
|
||||
}
|
||||
|
||||
FloatRect hFlipped() const
|
||||
{
|
||||
return FloatRect(x+w, y, -w, h);
|
||||
}
|
||||
|
||||
Vec2 corner(int i) const
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0 : return topLeft();
|
||||
case 1 : return topRight();
|
||||
case 2 : return bottomRight();
|
||||
case 3 : return bottomLeft();
|
||||
default : return Vec2();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Value between 0 and 255 with internal
|
||||
|
@ -274,13 +208,13 @@ struct NormValue
|
|||
|
||||
NormValue(int unNorm)
|
||||
: unNorm(unNorm),
|
||||
norm(unNorm / 255.0f)
|
||||
norm(unNorm / 255.0)
|
||||
{}
|
||||
|
||||
void operator =(int value)
|
||||
{
|
||||
unNorm = clamp(value, 0, 255);
|
||||
norm = unNorm / 255.0f;
|
||||
norm = unNorm / 255.0;
|
||||
}
|
||||
|
||||
bool operator ==(int value) const
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue