Commit Graph

286 Commits

Author SHA1 Message Date
Jonas Kulla b6a299541f Bitmap: Fix #get_pixel returning bogus values
We never bound the Bitmap FBO to the READ binding point,
so glReadPixels was blindly reading data off of whatever
was last bound there.
2014-01-28 16:38:10 +01:00
Jonas Kulla 96d2707edb Bitmap: Fix #get_pixel returning bogus values
We never bound the Bitmap FBO to the READ binding point,
so glReadPixels was blindly reading data off of whatever
was last bound there.
2014-01-28 16:34:28 +01:00
Jonas Kulla f956f21ce1 Revert "Font: Adhere to spec and set Font.default_name to "MS PGothic""
This reverts commit c9423164d4.

Turns out the spec was not adjusted correctly for the
English RGSS version; the de facto default is "Arial"
after all.
2014-01-26 08:06:54 +01:00
Jonas Kulla b28863d8eb Add comment 2014-01-25 09:30:48 +01:00
Jonas Kulla 87c1e376b9 GLState: Add bound shader program to managed state
Squishes a handful of redundant binds per frame.
2014-01-20 00:58:39 +01:00
Jonas Kulla b729da249b Graphics: Don't unbind shader 2014-01-20 00:56:00 +01:00
Jonas Kulla e93e1fd292 debugwriter.h: Use std::newl instead of '\n' 2014-01-20 00:54:42 +01:00
Jonas Kulla f3572f5ba4 Bitmap: Don't unbind shader after render op
Since all rendering is now shader based, there's normally
no reason to ever unbind a shader program.
2014-01-20 00:53:58 +01:00
Jonas Kulla f39d1239bb TileAtlas: Slightly optimize out some allocation
User vector instead of list for colums.s
2014-01-16 19:17:46 +01:00
Jonas Kulla b0a41a23e0 Rename typedef and fix wrong documenting comment 2014-01-16 19:16:09 +01:00
Jonas Kulla 316457b988 Refactoring 2014-01-16 04:19:22 +01:00
Jonas Kulla 91efcfa06d FileSystem: More stringent RGSSAD header checks 2014-01-16 01:06:59 +01:00
Jonas Kulla bbb9bff239 FileSystem: Fix path cache for mounted zip archives 2014-01-15 01:51:56 +01:00
Jonas Kulla f14a379ee9 FileSystem: Trim redundant error message on ENOENT
MRI adds the "No such file or directory - " itself;
I guess we can just emulate this behavior everywhere else.
2014-01-15 01:47:16 +01:00
Jonas Kulla 64cb4ee4f1 Use stdint types 2014-01-15 01:43:46 +01:00
Jonas Kulla 0f004b8601 Spacing 2014-01-15 00:48:34 +01:00
Jonas Kulla c33144552a Config: Parse from command line options on top of config file
Any options that are not arrays (ie. RTP paths) specified
as command line options will override entries in mkxp.conf.

The syntax is: --<option>=<value>
2014-01-10 20:16:34 +01:00
Jonas Kulla b8fc5e25b9 Audio: Make thread names more descriptive 2014-01-07 16:06:50 +01:00
Jonas Kulla 0a53a894dc Merge branch 'master' of github.com:Ancurio/mkxp 2014-01-07 05:26:05 +01:00
Jonas Kulla 063793c4d9 Turn screenshots (F3) off by default 2014-01-07 05:25:00 +01:00
Edward Rudd c60ffa6384 fix npos comparison check in baseName method 2014-01-06 12:45:01 -05:00
Jonas Kulla 953f903149 Spacing 2014-01-05 16:09:00 +01:00
Jonas Kulla e9cf77dbce Config: Fix preceeding '/' in deducted game title
Also factor out the common code path
2014-01-05 10:31:15 +01:00
Jonas Kulla 19dc83a5d5 Bitmap: Supply image filename on loading error 2014-01-05 10:28:35 +01:00
Jonas Kulla 8ed6de22a4 Input: Return const -20 mouse position when outside window 2014-01-05 01:15:33 +01:00
Edward Rudd 318162a229 fix screen grab crash when in fullscreen
- read the FBO size NOT the screen size.
2014-01-04 13:52:11 +01:00
Jonas Kulla 56b49acf39 Spacing 2014-01-04 13:50:07 +01:00
Jonas Kulla 43321b8ed7 Coding style fixes 2014-01-04 13:49:32 +01:00
Jonas Kulla 092e6ad948 Typo 2014-01-04 13:48:23 +01:00
Jonas Kulla d93c1280aa Font: Open TTF font as late as possible
This reduces opened fonts that were never going
to be used anyway.
2014-01-04 13:47:00 +01:00
Jonas Kulla 857693d4a1 Font: Fix 'Font#set_name' not actually changing underlying TTF_Font 2014-01-04 13:00:38 +01:00
Jonas Kulla 78f9272e3d Typo 2014-01-04 13:00:04 +01:00
Jonas Kulla c9423164d4 Font: Adhere to spec and set Font.default_name to "MS PGothic" 2014-01-04 12:58:03 +01:00
Jonas Kulla a8bff666eb Audio: Don't try to fill and queue null buffer
Fixes skipping audio after interrupting and resuming
the program via eg. a debugger.
2014-01-04 12:28:16 +01:00
Jonas Kulla 3daf805350 Table: Serialize actual table dimensions instead of '3'
This allows savegames created with mkxp to be read with RMXP.
2014-01-02 03:39:22 +01:00
Jonas Kulla 5f16eef273 EventThread: Properly allocate SDL user event codes 2014-01-02 02:22:10 +01:00
Jonas Kulla 0a336ea315 Spacing 2014-01-02 00:17:31 +01:00
Jonas Kulla a0a27889a3 Merge #8 2014-01-02 00:11:57 +01:00
Edward Rudd 5b4f0b239c add config option to set the window icon 2014-01-01 16:52:07 -05:00
Edward Rudd a740f7754c add option to choose whether left alt or both alts toggle's fullscreen 2014-01-01 15:56:38 -05:00
Edward Rudd c6bd61d2de code style fixes 2014-01-01 11:01:05 -05:00
Jonas Kulla 1bacceddf0 Spacing 2014-01-01 12:59:40 +01:00
Jonas Kulla ce7bf97dd4 FileSystem: Make path caching optional via config
Because Windows has case insensitive paths, this should
be turned on (which it is by default) for maximum
compatibility. Can be turned off as an optimization
(this will speed up startup a little depending on the
number of game assets).
2014-01-01 07:13:35 +01:00
Edward Rudd a18497ca7b change to exe dir on startup and add some extra guards around boost program option parsing. 2013-12-31 21:03:53 -05:00
Jonas Kulla 3f08b6b3db Remove dead code 2014-01-01 02:13:02 +01:00
Edward Rudd e87bdb8a95 cleaner approach to handling the viewport bug 2013-12-31 19:56:20 -05:00
Edward Rudd f42539e02b accept any alt for fullscreen switch 2013-12-31 19:31:29 -05:00
Edward Rudd 1120c60cae fix viewport resizing on screen resize. 2013-12-31 19:31:14 -05:00
Edward Rudd f8e8d704b5 use copy construction to pass the config along so the main constructor gets run once. 2013-12-31 17:23:15 -05:00
Edward Rudd f2bb0b2e79 initialize gameFolder to be SDL_GetBasePath() 2013-12-31 17:19:05 -05:00
Edward Rudd 7aa07630e4 can't sizeof an iVar in a static function 2013-12-31 16:32:12 -05:00
Edward Rudd af70e8c1ff correct ScanRow forward declares 2013-12-31 16:31:24 -05:00
Edward Rudd eacc143ea0 update extension usage..
nearly all of the previous required extensions are CORE in OpenGL 2.0
the remaining ones need to have fallback checks for ARB vs EXT vs APPLE 
variants..
2013-12-31 16:31:03 -05:00
Edward Rudd 27ae261d0e don't use base name it's destructive to the incoming string which you shouldn't modify as c_str() is const. 2013-12-31 16:27:28 -05:00
Jonas Kulla f2d2a1886f Shader: Throw on compile/link error, and print info logs
Also let go of the startup debug prints when compiling.
The engine will now tell us properly which shader fails
at which part.
2013-12-30 01:38:47 +01:00
Jonas Kulla 680e407a38 SharedState: Throw exception on errors (and handle them)
First up: throw if chdir(gameFolder) fails.
2013-12-30 01:37:55 +01:00
Jonas Kulla 9759e52b3c Exception: Constructor now takes printf style arguments 2013-12-29 18:05:11 +01:00
Jonas Kulla d8e22a8b3c Remove unused definition 2013-12-29 14:36:32 +01:00
Jonas Kulla 2adf8ab265 Transition from QtCore to stdc++ / STL / boost
This looks like a pretty major change, but in reality,
80% of it is just renames of types and corresponding
methods.

The config parsing code has been completely replaced
with a boost::program_options based version. This
means that the config file format slightly changed
(checkout the updated README).

I still expect there to be bugs / unforseen events.
Those should be fixed in follow up commits.

Also, finally reverted back to using pkg-config to
locate and link libruby. Yay for less hacks!
2013-12-29 13:59:26 +01:00
Jonas Kulla 01529c5741 Audio: Fix stream not being unlocked on exception 2013-12-28 23:10:43 +01:00
Jonas Kulla 99866fb84c Replace QStack with std::stack 2013-12-27 20:10:01 +01:00
Jonas Kulla 922a16a013 TexPool: Fix wrong total memory consumption calculation
The byte count of textures released into the pool was
erroneously added twice to the total byte count.
2013-12-27 18:46:04 +01:00
Jonas Kulla fbf02cf2ce Remove Qt style forloop 2013-12-27 06:19:30 +01:00
Jonas Kulla f3def32461 Constify 2013-12-27 06:11:18 +01:00
Jonas Kulla 231e38ae8e Replace QVector, QList with std::vector, std::list
An exception is made of TexPool, which will need a
bit more testing before transitioning to std containers.

Also replace 'int' with 'size_t' where it is used only
as an array index.
2013-12-26 20:18:33 +01:00
Jonas Kulla 8215bc7e7d Remove useless lines 2013-12-26 15:00:03 +01:00
Jonas Kulla 19bb6c924e Gaphics: Make frame skip a config option
When using something like Valgrind that will run
mkxp 20 times slower than normal, frame skip will
make the redraw loop completely grind to a halt.
Set 'frameSkip' to false in the config to
avert this.
2013-12-21 21:18:20 +01:00
Jonas Kulla cb36a28b09 Add a very crude screenshot function (press F3)
Files are named after the current date+time (down to seconds),
and written to the gameFolder directory.
2013-12-20 09:17:15 +01:00
Jonas Kulla 99cbb4d594 FileSystem: Remove useless code 2013-12-20 07:38:29 +01:00
Jonas Kulla f1df97551c FileSystem: Add "otf" to recognized font extensions 2013-12-15 10:19:22 +01:00
Jonas Kulla 5f290c5b11 Audio: Prevent div-by-zero 2013-12-15 10:12:44 +01:00
Jonas Kulla 8161b00804 Remove unneeded include 2013-12-11 23:52:20 +01:00
Jonas Kulla 3b8484a280 Audio: Silence "unused" errors with latest libvorbisfile 2013-12-11 21:08:40 +01:00
Jonas Kulla 1f2470deb7 Graphics: Fix some RGSS2 bitrot 2013-12-11 21:07:41 +01:00
Jonas Kulla 0035c23641 Shader: Group all shaders in one collective struct
Makes sharedstate.{cpp|h} a lot easier to read, and
adding new shaders a one liner.
2013-12-11 05:22:13 +01:00
Jonas Kulla 8c6648f47e Use std algorithm functions 2013-12-08 13:19:22 +01:00
Jonas Kulla ef12e96158 Remove completely outdated note 2013-12-08 13:01:59 +01:00
Jonas Kulla 946d778b96 Audio: Fix BGM not starting after ME has ended
A previous commit prevented the MeWatch from
starting a BGM stream that was in stopped state.
However, when a new BGM is loaded while the ME
is still playing, the BGM stream will be stopped
even though we want it to start after the ME
finishes.

Also add some comments trying to explain members
of 'AudioStream' a bit better.
2013-12-08 12:58:39 +01:00
Jonas Kulla bf712f3738 Graphics: Remove useless and confusing function 2013-12-08 12:57:46 +01:00
Jonas Kulla 5328d17090 Graphics: Fix viewport effect rendering bug
We didn't account for the spec dictating that
scissor test does affect FBO blit operations,
which resulted in corrupted output if more than
one viewport with an active effect (tone, color)
was created.

The reason I never caught this before must be
that the fglrx-legacy driver is actually bugged
in this aspect and ignores the scissor on blit.
2013-12-08 12:23:12 +01:00
Jonas Kulla 8ac70b7879 Sprite: Perform CPU visibility culling 2013-12-06 15:55:18 +01:00
Jonas Kulla 6e3b1d9466 Sprite: Don't draw when opacity == 0 2013-12-05 18:27:53 +01:00
Jonas Kulla 648684e4aa Don't expose global modules' con/destructors
This is just a small change to make the C++ API
match the binding counterparts more closely.
2013-12-05 00:34:11 +01:00
Jonas Kulla 5fca94616c Audio: Implement RGSS3 functionality
'Pos' and 'Play' functions take a float for
their 'pos' parameter, which is in seconds
of playback.

'setupMidi' is a noop at this point.
2013-12-05 00:24:18 +01:00
Jonas Kulla ef2430e0c3 Sanitize #include statements
The general rule I'm aiming for is to <> include
system wide / installed paths / generally everything
that's outside the git managed source tree (this means
mruby paths too!), and "" include everything else,
ie. local mkxp headers.

The only current exception are the mri headers, which
all have './' at their front as to not clash with
system wide ruby headers. I'm leaving them be for now
until I can come up with a better general solution.
2013-12-04 17:48:37 +01:00
Jonas Kulla 9a63140f3e Audio: MeWatch: Don't resume stopped BGM 2013-12-04 17:16:18 +01:00
Jonas Kulla 04526987e4 Audio: Implement RGSS2 ogg looping
With this we now link to libvorbis/ogg directly.
When this is enabled, one can theoretically also
build SDL_sound without ogg support, although I
doubt it makes much of a difference.

Adittionally, count frames instead of samples
for playback offset calculation.
2013-12-04 16:44:34 +01:00
Jonas Kulla 226e860c38 Bitmap: Fix renaming issue in RGSS2 code 2013-12-04 15:53:42 +01:00
Jonas Kulla a817b31e7c Audio: Remove all traces of rubberband
We will not be using librubberband for in place
pitch shifting. RMXP "shifts" PCM based audio
by just playing it back slower/faster, which
OpenAL takes care of for us. A native midi backend
will be able to effortlessly pitch shift by
multiplying note pitches, should we ever get one.

I have been chasing this ghost for way too long.
2013-12-04 14:49:35 +01:00
Jonas Kulla e26d0366f1 Revert "Audio: Make cheap OpenAL pitch shifting a config option"
Making this an option makes no sense. It ought to
be the default behavior, as RMXP pitch shifts PCM
based audio files the exact same way.

This reverts commit ac35d4214e.
2013-12-04 13:39:39 +01:00
Jonas Kulla ac35d4214e Audio: Make cheap OpenAL pitch shifting a config option 2013-12-01 09:36:15 +01:00
Jonas Kulla a65956818f Bitmap: Feed image extension into SDL2_image for faster loading 2013-11-30 14:28:50 +01:00
Jonas Kulla 64f35071ab Audio: Replace SFML solution by using OpenAL directly
This is a major change in the Audio module that comes with
many changes throughout the codebase and dependency list.
The main gist is that we're finally nuking the last pieces
of SFML from the project. sfml-audio brought with itself
unneeded and big dependencies (libsndfile, libvorbisenc)
while at the same time limiting the amount of audio formats
mkxp can support (eg. we now get mp3 for free, and wma/midi
can be implemented by extending SDL_sound directly).

The increased control gained by interfacing with OpenAL directly
will also allow for easy integration of a dedicated audio
stretcher (librubberband), as well as enable us to implement
looped ogg vorbis (via the 'LOOPSTART'/'LOOPLENGTH' tags),
as required by RGSS2, in the future.

The FileSystem class has had its SFML parts removed.
Aditionally, audio file extensions to be supplemented are
now automatically detected based on how SDL_sound was
built (ie. if no mp3 support was built, mkxp won't try
to look for *.mp3 files). The final used extension
can be optionally returned by 'openRead' calls so
SDL_sound and SDL2_image can immediately choose the
right decoder.

The OpenAL context is created and destroyed in main.cpp
along side the GL context.
2013-11-30 12:00:11 +01:00
Jonas Kulla 0b195cbffc Perftimer: Make GPU query count configurable 2013-11-30 11:47:03 +01:00
Jonas Kulla 0038d27c11 Input: Fix default key bindings 2013-11-30 11:45:17 +01:00
Jonas Kulla ac9bc21947 TexPool: Simplify code 2013-11-23 12:40:23 +01:00
Jonas Kulla da2f68cdba TexPool: Rename 'CacheObject' to 'CacheNode' 2013-11-23 12:27:10 +01:00
Jonas Kulla 06f5a06f67 Filesystem: Optimize RGSSAD file enumeration
Finally got around to nuking that ugly pile of shit that was
previously there for PhysFS file enumeration because filepath
cache generation with unencrypted game files + archive + RTP
has started taking around 6 seconds. Thank $DEITY.
2013-11-01 08:24:14 +01:00
Jonas Kulla 28ff5cd33c Bitmap: Ensure cloned bitmap is non-mega 2013-10-31 10:26:39 +01:00
Jonas Kulla 7549778dc6 Font: Add clone constructor 2013-10-31 10:09:57 +01:00